getTargetType(); $b_type = $b->getTargetType(); $type_order = strnatcasecmp($a_type, $b_type); return $type_order != 0 ? $type_order : parent::sort($a, $b); } /** * {@inheritdoc} */ public function getTargetType() { return $this->targetEntityType; } /** * {@inheritdoc} */ public function setTargetType($target_entity_type) { $this->targetEntityType = $target_entity_type; return $this; } /** * {@inheritdoc} */ public function calculateDependencies() { parent::calculateDependencies(); $target_entity_type = \Drupal::entityManager()->getDefinition($this->targetEntityType); $this->addDependency('module', $target_entity_type->getProvider()); return $this; } /** * {@inheritdoc} */ public function preSave(EntityStorageInterface $storage) { parent::preSave($storage); \Drupal::entityManager()->clearCachedFieldDefinitions(); } /** * {@inheritdoc} */ public static function preDelete(EntityStorageInterface $storage, array $entities) { parent::preDelete($storage, $entities); \Drupal::entityManager()->clearCachedFieldDefinitions(); } }