diff --git a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php index a518209..4de891a 100644 --- a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php +++ b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php @@ -122,7 +122,7 @@ public function __construct(array $values, $entity_type) { throw new \InvalidArgumentException('Missing required properties for an EntityDisplay entity.'); } - if (!$this->entityManager()->getDefinition($values['targetEntityType']) instanceof ContentEntityTypeInterface) { + if (!$this->entityManager()->getDefinition($values['targetEntityType'])->isSubclassOf('\Drupal\Core\Entity\FieldableEntityInterface')) { throw new \InvalidArgumentException('EntityDisplay entities can only handle fieldable entity types.'); } diff --git a/core/lib/Drupal/Core/Entity/EntityType.php b/core/lib/Drupal/Core/Entity/EntityType.php index fa1c6d0..60f3315 100644 --- a/core/lib/Drupal/Core/Entity/EntityType.php +++ b/core/lib/Drupal/Core/Entity/EntityType.php @@ -13,11 +13,6 @@ * @ingroup entity_api */ class EntityType implements EntityTypeInterface { - - /* - * Defines EntityChangedInterface constant for internal usage - */ - const ENTITY_TYPE_ENTITY_CHANGED_INTERFACE = 'Drupal\Core\Entity\EntityChangedInterface'; use StringTranslationTrait; @@ -306,7 +301,7 @@ public function __construct($definition) { // Automatically add the EntityChanged constraint if the entity type tracks // the changed time. - if (is_subclass_of($this->getClass(), self::ENTITY_TYPE_ENTITY_CHANGED_INTERFACE)) { + if (is_subclass_of($this->getClass(), EntityChangedInterface::class)) { $this->addConstraint('EntityChanged'); } diff --git a/core/lib/Drupal/Core/Field/FieldModuleUninstallValidator.php b/core/lib/Drupal/Core/Field/FieldModuleUninstallValidator.php index dc75fb0..05300f1 100644 --- a/core/lib/Drupal/Core/Field/FieldModuleUninstallValidator.php +++ b/core/lib/Drupal/Core/Field/FieldModuleUninstallValidator.php @@ -44,7 +44,7 @@ public function validate($module_name) { // We skip entity types defined by the module as there must be no // content to be able to uninstall them anyway. // See \Drupal\Core\Entity\ContentUninstallValidator. - if ($entity_type->getProvider() != $module_name && $entity_type instanceof ContentEntityTypeInterface) { + if ($entity_type->getProvider() != $module_name && $entity_type->isSubclassOf('\Drupal\Core\Entity\FieldableEntityInterface')) { foreach ($this->entityManager->getFieldStorageDefinitions($entity_type_id) as $storage_definition) { if ($storage_definition->getProvider() == $module_name) { $storage = $this->entityManager->getStorage($entity_type_id); diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php index f2a3145..22d6e08 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php @@ -67,7 +67,7 @@ public static function propertyDefinitions(FieldStorageDefinitionInterface $fiel $target_type_info = \Drupal::entityManager()->getDefinition($settings['target_type']); $target_id_data_type = 'string'; - if ($target_type_info instanceof ContentEntityTypeInterface) { + if ($target_type_info->isSubclassOf('\Drupal\Core\Entity\FieldableEntityInterface')) { $id_definition = \Drupal::entityManager()->getBaseFieldDefinitions($settings['target_type'])[$target_type_info->getKey('id')]; if ($id_definition->getType() === 'integer') { $target_id_data_type = 'integer'; diff --git a/core/modules/comment/src/CommentManager.php b/core/modules/comment/src/CommentManager.php index 8fdeb4e..49aef42 100644 --- a/core/modules/comment/src/CommentManager.php +++ b/core/modules/comment/src/CommentManager.php @@ -100,7 +100,7 @@ public function __construct(EntityManagerInterface $entity_manager, QueryFactory */ public function getFields($entity_type_id) { $entity_type = $this->entityManager->getDefinition($entity_type_id); - if (!$entity_type instanceof ContentEntityTypeInterface) { + if (!$entity_type->isSubclassOf('\Drupal\Core\Entity\FieldableEntityInterface')) { // Early return, only content types can carry comment fields. return array(); }