diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php index c6618a6..eb1cb81 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php @@ -68,11 +68,11 @@ public function postSave(EntityStorageInterface $storage, $update = TRUE) { parent::postSave($storage, $update); if (!$update) { - $this->entityManager()->onBundleCreate($this->getEntityType()->getBundleOf(), $this->id()); + $this->entityManager()->onBundleCreate($this->id(), $this->getEntityType()->getBundleOf()); } elseif ($this->getOriginalId() != $this->id()) { $this->renameDisplays(); - $this->entityManager()->onBundleRename($this->getEntityType()->getBundleOf(), $this->getOriginalId(), $this->id()); + $this->entityManager()->onBundleRename($this->getOriginalId(), $this->id(), $this->getEntityType()->getBundleOf()); } } @@ -84,7 +84,7 @@ public static function postDelete(EntityStorageInterface $storage, array $entiti foreach ($entities as $entity) { $entity->deleteDisplays(); - \Drupal::entityManager()->onBundleDelete($entity->getEntityType()->getBundleOf(), $entity->id()); + \Drupal::entityManager()->onBundleDelete($entity->id(), $entity->getEntityType()->getBundleOf()); } } diff --git a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php index 6d75946..cf97d49 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php @@ -12,7 +12,7 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface; use Symfony\Component\DependencyInjection\ContainerInterface; -abstract class ContentEntityStorageBase extends EntityStorageBase implements FieldableEntityStorageInterface { +abstract class ContentEntityStorageBase extends EntityStorageBase implements DynamicallyFieldableEntityStorageInterface { /** * The entity bundle key. @@ -106,21 +106,6 @@ public function onFieldDefinitionDelete(FieldDefinitionInterface $field_definiti /** * {@inheritdoc} */ - public function onBundleCreate($bundle) { } - - /** - * {@inheritdoc} - */ - public function onBundleRename($bundle, $bundle_new) { } - - /** - * {@inheritdoc} - */ - public function onBundleDelete($bundle) { } - - /** - * {@inheritdoc} - */ public function purgeFieldData(FieldDefinitionInterface $field_definition, $batch_size) { $items_by_entity = $this->readFieldItemsToPurge($field_definition, $batch_size); diff --git a/core/lib/Drupal/Core/Entity/FieldableEntityStorageInterface.php b/core/lib/Drupal/Core/Entity/DynamicallyFieldableEntityStorageInterface.php similarity index 76% rename from core/lib/Drupal/Core/Entity/FieldableEntityStorageInterface.php rename to core/lib/Drupal/Core/Entity/DynamicallyFieldableEntityStorageInterface.php index aaab687..6d12c98 100644 --- a/core/lib/Drupal/Core/Entity/FieldableEntityStorageInterface.php +++ b/core/lib/Drupal/Core/Entity/DynamicallyFieldableEntityStorageInterface.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\Core\Entity\FieldableEntityStorageInterface. + * Contains \Drupal\Core\Entity\DynamicallyFieldableEntityStorageInterface. */ namespace Drupal\Core\Entity; @@ -11,8 +11,16 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Field\FieldStorageDefinitionListenerInterface; -interface FieldableEntityStorageInterface extends EntityStorageInterface, FieldStorageDefinitionListenerInterface { - +/** + * A storage that supports entity types with dynamic field definitions. + * + * A storage that implements this interface can react to the entity type's field + * definitions changing, due to modules being installed or uninstalled, or via + * field UI, or via code changes to the entity class. + * + * For example, configurable fields defined and exposed by field.module. + */ +interface DynamicallyFieldableEntityStorageInterface extends EntityStorageInterface, FieldStorageDefinitionListenerInterface { /** * Reacts to the creation of a field. * @@ -45,36 +53,6 @@ public function onFieldDefinitionUpdate(FieldDefinitionInterface $field_definiti public function onFieldDefinitionDelete(FieldDefinitionInterface $field_definition); /** - * Reacts to a bundle being created. - * - * @param string $bundle - * The name of the bundle created. - */ - public function onBundleCreate($bundle); - - /** - * Reacts to a bundle being renamed. - * - * This method runs before fields are updated with the new bundle name. - * - * @param string $bundle - * The name of the bundle being renamed. - * @param string $bundle_new - * The new name of the bundle. - */ - public function onBundleRename($bundle, $bundle_new); - - /** - * Reacts to a bundle being deleted. - * - * This method runs before fields are deleted. - * - * @param string $bundle - * The name of the bundle being deleted. - */ - public function onBundleDelete($bundle); - - /** * Purges a batch of field data. * * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition diff --git a/core/lib/Drupal/Core/Entity/EntityBundleListenerInterface.php b/core/lib/Drupal/Core/Entity/EntityBundleListenerInterface.php new file mode 100644 index 0000000..cbe96b3 --- /dev/null +++ b/core/lib/Drupal/Core/Entity/EntityBundleListenerInterface.php @@ -0,0 +1,53 @@ +isFieldable()) { + if ($this->entityManager->getStorage($entity_type_id) instanceof DynamicallyFieldableEntityStorageInterface) { $field_changes = array(); $storage_definitions = $this->entityManager->getFieldStorageDefinitions($entity_type_id); $original_storage_definitions = $this->entityManager->getLastInstalledFieldStorageDefinitions($entity_type_id); diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index 94fe169..d1ceaec 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -987,7 +987,7 @@ public function onEntityTypeCreate(EntityTypeInterface $entity_type) { } $this->setLastInstalledDefinition($entity_type); - if ($entity_type->isFieldable()) { + if ($entity_type->isSubclassOf('\Drupal\Core\Entity\ContentEntityInterface')) { $this->setLastInstalledFieldStorageDefinitions($entity_type_id, $this->getFieldStorageDefinitions($entity_type_id)); } } @@ -1078,12 +1078,12 @@ public function onFieldStorageDefinitionDelete(FieldStorageDefinitionInterface $ /** * {@inheritdoc} */ - public function onBundleCreate($entity_type_id, $bundle) { + public function onBundleCreate($bundle, $entity_type_id) { $this->clearCachedBundles(); // Notify the entity storage. $storage = $this->getStorage($entity_type_id); - if ($storage instanceof FieldableEntityStorageInterface) { - $storage->onBundleCreate($bundle); + if ($storage instanceof EntityBundleListenerInterface) { + $storage->onBundleCreate($bundle, $entity_type_id); } // Invoke hook_entity_bundle_create() hook. $this->moduleHandler->invokeAll('entity_bundle_create', array($entity_type_id, $bundle)); @@ -1092,12 +1092,12 @@ public function onBundleCreate($entity_type_id, $bundle) { /** * {@inheritdoc} */ - public function onBundleRename($entity_type_id, $bundle_old, $bundle_new) { + public function onBundleRename($bundle_old, $bundle_new, $entity_type_id) { $this->clearCachedBundles(); // Notify the entity storage. $storage = $this->getStorage($entity_type_id); - if ($storage instanceof FieldableEntityStorageInterface) { - $storage->onBundleRename($bundle_old, $bundle_new); + if ($storage instanceof EntityBundleListenerInterface) { + $storage->onBundleRename($bundle_old, $bundle_new, $entity_type_id); } // Rename existing base field bundle overrides. @@ -1117,12 +1117,12 @@ public function onBundleRename($entity_type_id, $bundle_old, $bundle_new) { /** * {@inheritdoc} */ - public function onBundleDelete($entity_type_id, $bundle) { + public function onBundleDelete($bundle, $entity_type_id) { $this->clearCachedBundles(); // Notify the entity storage. $storage = $this->getStorage($entity_type_id); - if ($storage instanceof FieldableEntityStorageInterface) { - $storage->onBundleDelete($bundle); + if ($storage instanceof EntityBundleListenerInterface) { + $storage->onBundleDelete($bundle, $entity_type_id); } // Invoke hook_entity_bundle_delete() hook. $this->moduleHandler->invokeAll('entity_bundle_delete', array($entity_type_id, $bundle)); diff --git a/core/lib/Drupal/Core/Entity/EntityManagerInterface.php b/core/lib/Drupal/Core/Entity/EntityManagerInterface.php index 7a13fff..daea71f 100644 --- a/core/lib/Drupal/Core/Entity/EntityManagerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityManagerInterface.php @@ -13,7 +13,7 @@ /** * Provides an interface for entity type managers. */ -interface EntityManagerInterface extends PluginManagerInterface, EntityTypeListenerInterface, FieldStorageDefinitionListenerInterface { +interface EntityManagerInterface extends PluginManagerInterface, EntityTypeListenerInterface, EntityBundleListenerInterface, FieldStorageDefinitionListenerInterface { /** * Builds a list of entity type labels suitable for a Form API options list. @@ -465,42 +465,4 @@ public function loadEntityByUuid($entity_type_id, $uuid); */ public function getEntityTypeFromClass($class_name); - /** - * Reacts to the creation of a entity bundle. - * - * @param string $entity_type_id - * The entity type to which the bundle is bound; e.g. 'node' or 'user'. - * @param string $bundle - * The name of the bundle. - * - * @see entity_crud - */ - public function onBundleCreate($entity_type_id, $bundle); - - /** - * Reacts to the rename of a entity bundle. - * - * @param string $entity_type_id - * The entity type to which the bundle is bound; e.g. 'node' or 'user'. - * @param string $bundle_old - * The previous name of the bundle. - * @param string $bundle_new - * The new name of the bundle. - * - * @see entity_crud - */ - public function onBundleRename($entity_type_id, $bundle_old, $bundle_new); - - /** - * Reacts to the deletion of a entity bundle. - * - * @param string $entity_type_id - * The entity type to which the bundle is bound; e.g. 'node' or 'user'. - * @param string $bundle - * The bundle that was just deleted. - * - * @see entity_crud - */ - public function onBundleDelete($entity_type_id, $bundle); - } diff --git a/core/lib/Drupal/Core/Entity/EntityType.php b/core/lib/Drupal/Core/Entity/EntityType.php index 79c092e..8cc1cbe 100644 --- a/core/lib/Drupal/Core/Entity/EntityType.php +++ b/core/lib/Drupal/Core/Entity/EntityType.php @@ -101,14 +101,6 @@ class EntityType implements EntityTypeInterface { * @var string */ protected $permission_granularity = 'entity_type'; - - /** - * Indicates whether fields can be attached to entities of this type. - * - * @var bool - */ - protected $fieldable = FALSE; - /** * Link templates using the URI template syntax. * @@ -503,13 +495,6 @@ public function getPermissionGranularity() { /** * {@inheritdoc} */ - public function isFieldable() { - return $this->fieldable; - } - - /** - * {@inheritdoc} - */ public function getLinkTemplates() { return $this->links; } diff --git a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php index 7e8662b..40f5d5d 100644 --- a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php @@ -396,14 +396,6 @@ public function getAdminPermission(); public function getPermissionGranularity(); /** - * Indicates whether fields can be attached to entities of this type. - * - * @return bool - * Returns TRUE if the entity type can has fields, otherwise FALSE. - */ - public function isFieldable(); - - /** * Returns link templates using the URI template syntax. * * Links are an array of standard link relations to the URI template that diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php index af81e10..3136847 100644 --- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php @@ -13,6 +13,7 @@ use Drupal\Core\Database\Database; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\ContentEntityStorageBase; +use Drupal\Core\Entity\EntityBundleListenerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityStorageException; @@ -38,7 +39,7 @@ * * @ingroup entity_api */ -class SqlContentEntityStorage extends ContentEntityStorageBase implements SqlEntityStorageInterface, FieldableEntityStorageSchemaInterface { +class SqlContentEntityStorage extends ContentEntityStorageBase implements SqlEntityStorageInterface, FieldableEntityStorageSchemaInterface, EntityBundleListenerInterface { /** * The mapping of field columns to SQL tables. @@ -605,9 +606,7 @@ protected function mapFromStorageRecords(array $records) { $this->attachPropertyData($entities); // Attach field values. - if ($this->entityType->isFieldable()) { - $this->loadFieldItems($entities); - } + $this->loadFieldItems($entities); return $entities; } @@ -1180,7 +1179,7 @@ public function getQueryServiceName() { * An array of entities keyed by entity ID. */ protected function loadFieldItems(array $entities) { - if (empty($entities) || !$this->entityType->isFieldable()) { + if (empty($entities)) { return; } @@ -1546,7 +1545,17 @@ public function onFieldDefinitionDelete(FieldDefinitionInterface $field_definiti /** * {@inheritdoc} */ - public function onBundleRename($bundle, $bundle_new) { + public function onBundleCreate($bundle, $entity_type_id) { } + + /** + * {@inheritdoc} + */ + public function onBundleDelete($bundle, $entity_type_id) { } + + /** + * {@inheritdoc} + */ + public function onBundleRename($bundle, $bundle_new, $entity_type_id) { // The method runs before the field definitions are updated, so we use the // old bundle name. $field_definitions = $this->entityManager->getFieldDefinitions($this->entityTypeId, $bundle); diff --git a/core/lib/Drupal/Core/Extension/ModuleHandler.php b/core/lib/Drupal/Core/Extension/ModuleHandler.php index f0b06dd..ae2f890 100644 --- a/core/lib/Drupal/Core/Extension/ModuleHandler.php +++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php @@ -944,7 +944,7 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) { foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) { if ($entity_type->getProvider() == $module) { foreach (array_keys($entity_manager->getBundleInfo($entity_type_id)) as $bundle) { - $entity_manager->onBundleDelete($entity_type_id, $bundle); + $entity_manager->onBundleDelete($bundle, $entity_type_id); } } } diff --git a/core/modules/aggregator/src/Entity/Feed.php b/core/modules/aggregator/src/Entity/Feed.php index 5bcd787..6532f36 100644 --- a/core/modules/aggregator/src/Entity/Feed.php +++ b/core/modules/aggregator/src/Entity/Feed.php @@ -39,7 +39,6 @@ * }, * field_ui_base_route = "aggregator.admin_overview", * base_table = "aggregator_feed", - * fieldable = TRUE, * render_cache = FALSE, * entity_keys = { * "id" = "fid", diff --git a/core/modules/aggregator/src/Entity/Item.php b/core/modules/aggregator/src/Entity/Item.php index 5df7013..493e4cb 100644 --- a/core/modules/aggregator/src/Entity/Item.php +++ b/core/modules/aggregator/src/Entity/Item.php @@ -30,7 +30,6 @@ * }, * uri_callback = "Drupal\aggregator\Entity\Item::buildUri", * base_table = "aggregator_item", - * fieldable = TRUE, * render_cache = FALSE, * entity_keys = { * "id" = "iid", diff --git a/core/modules/block/src/Entity/Block.php b/core/modules/block/src/Entity/Block.php index 0c71ed1..0036eb8 100644 --- a/core/modules/block/src/Entity/Block.php +++ b/core/modules/block/src/Entity/Block.php @@ -31,7 +31,6 @@ * } * }, * admin_permission = "administer blocks", - * fieldable = FALSE, * entity_keys = { * "id" = "id" * }, diff --git a/core/modules/block_content/src/Entity/BlockContent.php b/core/modules/block_content/src/Entity/BlockContent.php index 2d035ec..e2320bd 100644 --- a/core/modules/block_content/src/Entity/BlockContent.php +++ b/core/modules/block_content/src/Entity/BlockContent.php @@ -43,7 +43,6 @@ * "delete-form" = "entity.block_content.delete_form", * "edit-form" = "entity.block_content.canonical", * }, - * fieldable = TRUE, * translatable = TRUE, * entity_keys = { * "id" = "id", diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index d838125..4231ee5 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -412,7 +412,7 @@ function comment_entity_predelete(EntityInterface $entity) { // mismatched types. So, we need to verify that the ID is numeric (even for an // entity type that has an integer ID, $entity->id() might be a string // containing a number), and then cast it to an integer when querying. - if ($entity->getEntityType()->isFieldable() && is_numeric($entity->id())) { + if ($entity instanceof ContentEntityInterface && is_numeric($entity->id())) { $entity_query = \Drupal::entityQuery('comment'); $entity_query->condition('entity_id', (int) $entity->id()); $entity_query->condition('entity_type', $entity->getEntityTypeId()); diff --git a/core/modules/comment/comment.views.inc b/core/modules/comment/comment.views.inc index a3d873b..cdd7ec0 100644 --- a/core/modules/comment/comment.views.inc +++ b/core/modules/comment/comment.views.inc @@ -22,7 +22,7 @@ function comment_views_data_alter(&$data) { // Provide a integration for each entity type except comment. foreach (\Drupal::entityManager()->getDefinitions() as $entity_type_id => $entity_type) { - if ($entity_type_id == 'comment' || !$entity_type->isFieldable() || !$entity_type->getBaseTable()) { + if ($entity_type_id == 'comment' || !$entity_type->isSubclassOf('\Drupal\Core\Entity\ContentEntityInterface') || !$entity_type->getBaseTable()) { continue; } $fields = \Drupal::service('comment.manager')->getFields($entity_type_id); diff --git a/core/modules/comment/src/CommentTypeForm.php b/core/modules/comment/src/CommentTypeForm.php index 0d93b1c..3808657 100644 --- a/core/modules/comment/src/CommentTypeForm.php +++ b/core/modules/comment/src/CommentTypeForm.php @@ -7,6 +7,7 @@ namespace Drupal\comment; +use Drupal\Core\Entity\ContentEntityTypeInterface; use Drupal\Core\Entity\EntityForm; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityTypeInterface; @@ -91,7 +92,9 @@ public function form(array $form, FormStateInterface $form_state) { if ($comment_type->isNew()) { $options = array(); foreach ($this->entityManager->getDefinitions() as $entity_type) { - if ($entity_type->isFieldable()) { + // Only expose entities that have field UI enabled, only those can + // get comment fields added in the UI. + if ($entity_type->get('field_ui_base_route')) { $options[$entity_type->id()] = $entity_type->getLabel(); } } diff --git a/core/modules/comment/src/CommentViewsData.php b/core/modules/comment/src/CommentViewsData.php index 866bc99..ee4f1ce 100644 --- a/core/modules/comment/src/CommentViewsData.php +++ b/core/modules/comment/src/CommentViewsData.php @@ -386,7 +386,7 @@ public function getViewsData() { // Provide a relationship for each entity type except comment. foreach ($entities_types as $type => $entity_type) { - if ($type == 'comment' || !$entity_type->isFieldable() || !$entity_type->getBaseTable()) { + if ($type == 'comment' || !$entity_type->isSubclassOf('\Drupal\Core\Entity\ContentEntityInterface') || !$entity_type->getBaseTable()) { continue; } if ($fields = \Drupal::service('comment.manager')->getFields($type)) { @@ -465,7 +465,7 @@ public function getViewsData() { // Provide a relationship for each entity type except comment. foreach ($entities_types as $type => $entity_type) { - if ($type == 'comment' || !$entity_type->isFieldable() || !$entity_type->getBaseTable()) { + if ($type == 'comment' || !$entity_type->isSubclassOf('\Drupal\Core\Entity\ContentEntityInterface') || !$entity_type->getBaseTable()) { continue; } // This relationship does not use the 'field id' column, if the entity has diff --git a/core/modules/comment/src/Entity/Comment.php b/core/modules/comment/src/Entity/Comment.php index b49d993..57c7287 100644 --- a/core/modules/comment/src/Entity/Comment.php +++ b/core/modules/comment/src/Entity/Comment.php @@ -38,7 +38,6 @@ * base_table = "comment", * data_table = "comment_field_data", * uri_callback = "comment_uri", - * fieldable = TRUE, * translatable = TRUE, * entity_keys = { * "id" = "cid", diff --git a/core/modules/config_translation/config_translation.api.php b/core/modules/config_translation/config_translation.api.php index 9f7abfc..e44c168 100644 --- a/core/modules/config_translation/config_translation.api.php +++ b/core/modules/config_translation/config_translation.api.php @@ -48,8 +48,8 @@ function hook_config_translation_info(&$info) { // Ignore non-existent routes. } - // Make sure entity type is fieldable and has a base route. - if ($entity_type->isFieldable() && !empty($base_route)) { + // Make sure entity type has field UI enabled and has a base route. + if ($entity_type->get('field_ui_base_route') && !empty($base_route)) { $info[$entity_type_id . '_fields'] = array( 'base_route_name' => 'field_ui.field_edit_' . $entity_type_id, 'entity_type' => 'field_config', diff --git a/core/modules/config_translation/config_translation.module b/core/modules/config_translation/config_translation.module index fa5b183..956861a 100644 --- a/core/modules/config_translation/config_translation.module +++ b/core/modules/config_translation/config_translation.module @@ -120,8 +120,8 @@ function config_translation_config_translation_info(&$info) { // Ignore non-existent routes. } - // Make sure entity type is fieldable and has a base route. - if ($entity_type->isFieldable() && !empty($base_route)) { + // Make sure entity type has field UI enabled and has a base route. + if ($entity_type->get('field_ui_base_route') && !empty($base_route)) { $info[$entity_type_id . '_fields'] = array( 'base_route_name' => 'field_ui.field_edit_' . $entity_type_id, 'entity_type' => 'field_config', diff --git a/core/modules/contact/src/Entity/Message.php b/core/modules/contact/src/Entity/Message.php index bbccd17..20be2e8 100644 --- a/core/modules/contact/src/Entity/Message.php +++ b/core/modules/contact/src/Entity/Message.php @@ -31,7 +31,6 @@ * }, * bundle_entity_type = "contact_form", * field_ui_base_route = "entity.contact_form.edit_form", - * fieldable = TRUE, * ) */ class Message extends ContentEntityBase implements MessageInterface { diff --git a/core/modules/content_translation/src/ContentTranslationHandler.php b/core/modules/content_translation/src/ContentTranslationHandler.php index b619036..19ba5a1 100644 --- a/core/modules/content_translation/src/ContentTranslationHandler.php +++ b/core/modules/content_translation/src/ContentTranslationHandler.php @@ -100,6 +100,7 @@ public function entityFormAlter(array &$form, FormStateInterface $form_state, En unset($translations[$form_langcode]); } $is_translation = !$form_object->isDefaultFormLangcode($form_state); + debug($translations, 'translations'); $has_translations = count($translations) > 1; // Adjust page title to specify the current language being edited, if we @@ -117,6 +118,8 @@ public function entityFormAlter(array &$form, FormStateInterface $form_state, En // Display source language selector only if we are creating a new // translation and there are at least two translations available. + debug($has_translations, 'has'); + debug($new_translation, 'new'); if ($has_translations && $new_translation) { $form['source_langcode'] = array( '#type' => 'details', diff --git a/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php b/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php index 8bed5da..3e14a6a 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php @@ -173,31 +173,28 @@ protected function enableTranslation() { * Creates the test fields. */ protected function setupTestFields() { - $entity_type = \Drupal::entityManager()->getDefinition($this->entityTypeId); - if ($entity_type->isFieldable()) { - if (empty($this->fieldName)) { - $this->fieldName = 'field_test_et_ui_test'; - } - entity_create('field_storage_config', array( - 'field_name' => $this->fieldName, - 'type' => 'string', - 'entity_type' => $this->entityTypeId, - 'cardinality' => 1, - 'translatable' => TRUE, - ))->save(); - entity_create('field_config', array( - 'entity_type' => $this->entityTypeId, - 'field_name' => $this->fieldName, - 'bundle' => $this->bundle, - 'label' => 'Test translatable text-field', - ))->save(); - entity_get_form_display($this->entityTypeId, $this->bundle, 'default') - ->setComponent($this->fieldName, array( - 'type' => 'string_textfield', - 'weight' => 0, - )) - ->save(); + if (empty($this->fieldName)) { + $this->fieldName = 'field_test_et_ui_test'; } + entity_create('field_storage_config', array( + 'field_name' => $this->fieldName, + 'type' => 'string', + 'entity_type' => $this->entityTypeId, + 'cardinality' => 1, + 'translatable' => TRUE, + ))->save(); + entity_create('field_config', array( + 'entity_type' => $this->entityTypeId, + 'field_name' => $this->fieldName, + 'bundle' => $this->bundle, + 'label' => 'Test translatable text-field', + ))->save(); + entity_get_form_display($this->entityTypeId, $this->bundle, 'default') + ->setComponent($this->fieldName, array( + 'type' => 'string_textfield', + 'weight' => 0, + )) + ->save(); } /** diff --git a/core/modules/field/field.module b/core/modules/field/field.module index 980ec21..3988f25 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -6,6 +6,7 @@ use Drupal\Core\Config\ConfigImporter; use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\Core\Entity\DynamicallyFieldableEntityStorageInterface; use Drupal\Core\Extension\Extension; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Routing\RouteMatchInterface; @@ -152,20 +153,19 @@ function field_system_info_alter(&$info, Extension $file, $type) { * Implements hook_entity_field_storage_info(). */ function field_entity_field_storage_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) { - // Expose storage definitions for all exposed bundle fields. - if ($entity_type->isFieldable()) { + if (\Drupal::entityManager()->getStorage($entity_type->id()) instanceof DynamicallyFieldableEntityStorageInterface) { // Query by filtering on the ID as this is more efficient than filtering // on the entity_type property directly. $ids = \Drupal::entityQuery('field_storage_config') ->condition('id', $entity_type->id() . '.', 'STARTS_WITH') ->execute(); - // Fetch all fields and key them by field name. $field_storages = entity_load_multiple('field_storage_config', $ids); $result = array(); foreach ($field_storages as $field_storage) { $result[$field_storage->getName()] = $field_storage; } + return $result; } } @@ -174,19 +174,19 @@ function field_entity_field_storage_info(\Drupal\Core\Entity\EntityTypeInterface * Implements hook_entity_bundle_field_info(). */ function field_entity_bundle_field_info(EntityTypeInterface $entity_type, $bundle, array $base_field_definitions) { - if ($entity_type->isFieldable()) { + if (\Drupal::entityManager()->getStorage($entity_type->id()) instanceof DynamicallyFieldableEntityStorageInterface) { // Query by filtering on the ID as this is more efficient than filtering // on the entity_type property directly. $ids = \Drupal::entityQuery('field_config') ->condition('id', $entity_type->id() . '.' . $bundle . '.', 'STARTS_WITH') ->execute(); - // Fetch all fields and key them by field name. $field_configs = entity_load_multiple('field_config', $ids); $result = array(); - foreach ($field_configs as $field) { - $result[$field->getName()] = $field; + foreach ($field_configs as $field_instance) { + $result[$field_instance->getName()] = $field_instance; } + return $result; } } diff --git a/core/modules/field/src/Tests/FieldDataCountTest.php b/core/modules/field/src/Tests/FieldDataCountTest.php index 967e60f..cc1d792 100644 --- a/core/modules/field/src/Tests/FieldDataCountTest.php +++ b/core/modules/field/src/Tests/FieldDataCountTest.php @@ -20,7 +20,7 @@ class FieldDataCountTest extends FieldUnitTestBase { /** - * @var \Drupal\Core\Entity\FieldableEntityStorageInterface + * @var \Drupal\Core\Entity\DynamicallyFieldableEntityStorageInterface */ protected $storage; diff --git a/core/modules/field_ui/src/Controller/EntityDisplayModeController.php b/core/modules/field_ui/src/Controller/EntityDisplayModeController.php index a2e11c9..88ffd4e 100644 --- a/core/modules/field_ui/src/Controller/EntityDisplayModeController.php +++ b/core/modules/field_ui/src/Controller/EntityDisplayModeController.php @@ -24,7 +24,7 @@ class EntityDisplayModeController extends ControllerBase { public function viewModeTypeSelection() { $entity_types = array(); foreach ($this->entityManager()->getDefinitions() as $entity_type_id => $entity_type) { - if ($entity_type->isFieldable() && $entity_type->hasViewBuilderClass()) { + if ($entity_type->get('field_ui_base_route') && $entity_type->hasViewBuilderClass()) { $entity_types[$entity_type_id] = array( 'title' => $entity_type->getLabel(), 'url' => new Url('field_ui.entity_view_mode_add_type', array('entity_type_id' => $entity_type_id)), @@ -47,7 +47,7 @@ public function viewModeTypeSelection() { public function formModeTypeSelection() { $entity_types = array(); foreach ($this->entityManager()->getDefinitions() as $entity_type_id => $entity_type) { - if ($entity_type->isFieldable() && $entity_type->hasFormClasses()) { + if ($entity_type->get('field_ui_base_route') && $entity_type->hasFormClasses()) { $entity_types[$entity_type_id] = array( 'title' => $entity_type->getLabel(), 'url' => new Url('field_ui.entity_form_mode_add_type', array('entity_type_id' => $entity_type_id)), diff --git a/core/modules/field_ui/src/EntityDisplayModeListBuilder.php b/core/modules/field_ui/src/EntityDisplayModeListBuilder.php index f52d721..2a73834 100644 --- a/core/modules/field_ui/src/EntityDisplayModeListBuilder.php +++ b/core/modules/field_ui/src/EntityDisplayModeListBuilder.php @@ -92,8 +92,8 @@ public function render() { continue; } - // Filter entities - if ($this->entityTypes[$entity_type]->isFieldable() && !$this->isValidEntity($entity_type)) { + // Filter entities. + if (!$this->isValidEntity($entity_type)) { continue; } @@ -142,7 +142,7 @@ public function render() { * doesn't has the correct controller. */ protected function isValidEntity($entity_type) { - return $this->entityTypes[$entity_type]->hasViewBuilderClass(); + return $this->entityTypes[$entity_type]->get('field_ui_base_route') && $this->entityTypes[$entity_type]->hasViewBuilderClass(); } } diff --git a/core/modules/field_ui/src/FieldUiPermissions.php b/core/modules/field_ui/src/FieldUiPermissions.php index c71e938..48c8a64 100644 --- a/core/modules/field_ui/src/FieldUiPermissions.php +++ b/core/modules/field_ui/src/FieldUiPermissions.php @@ -52,7 +52,7 @@ public function fieldPermissions() { $permissions = []; foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) { - if ($entity_type->isFieldable()) { + if ($entity_type->get('field_ui_base_route')) { // Create a permission for each fieldable entity to manage // the fields and the display. $permissions['administer ' . $entity_type_id . ' fields'] = [ diff --git a/core/modules/field_ui/src/Form/EntityDisplayModeAddForm.php b/core/modules/field_ui/src/Form/EntityDisplayModeAddForm.php index f8075c9..cd207de 100644 --- a/core/modules/field_ui/src/Form/EntityDisplayModeAddForm.php +++ b/core/modules/field_ui/src/Form/EntityDisplayModeAddForm.php @@ -49,7 +49,7 @@ public function validate(array $form, FormStateInterface $form_state) { */ protected function prepareEntity() { $definition = $this->entityManager->getDefinition($this->targetEntityTypeId); - if (!$definition->isFieldable() || !$definition->hasViewBuilderClass()) { + if (!$definition->get('field_ui_base_route') || !$definition->hasViewBuilderClass()) { throw new NotFoundHttpException(); } diff --git a/core/modules/field_ui/src/Form/EntityFormModeAddForm.php b/core/modules/field_ui/src/Form/EntityFormModeAddForm.php index b00fb37..d7864ca 100644 --- a/core/modules/field_ui/src/Form/EntityFormModeAddForm.php +++ b/core/modules/field_ui/src/Form/EntityFormModeAddForm.php @@ -19,7 +19,7 @@ class EntityFormModeAddForm extends EntityDisplayModeAddForm { */ protected function prepareEntity() { $definition = $this->entityManager->getDefinition($this->targetEntityTypeId); - if (!$definition->isFieldable() || !$definition->hasFormClasses()) { + if (!$definition->get('field_ui_base_route') || !$definition->hasFormClasses()) { throw new NotFoundHttpException(); } diff --git a/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php b/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php index 788392c..ad1f7da 100644 --- a/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php +++ b/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php @@ -69,7 +69,7 @@ public function getDerivativeDefinitions($base_plugin_definition) { $this->derivatives = array(); foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) { - if ($entity_type->isFieldable() && $entity_type->get('field_ui_base_route')) { + if ($entity_type->get('field_ui_base_route')) { $this->derivatives["overview_$entity_type_id"] = array( 'route_name' => "field_ui.overview_$entity_type_id", 'weight' => 1, @@ -172,7 +172,7 @@ public function getDerivativeDefinitions($base_plugin_definition) { */ public function alterLocalTasks(&$local_tasks) { foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) { - if ($entity_type->isFieldable() && $route_name = $entity_type->get('field_ui_base_route')) { + if ($route_name = $entity_type->get('field_ui_base_route')) { $local_tasks["field_ui.fields:overview_$entity_type_id"]['base_route'] = $route_name; $local_tasks["field_ui.fields:form_display_overview_$entity_type_id"]['base_route'] = $route_name; $local_tasks["field_ui.fields:display_overview_$entity_type_id"]['base_route'] = $route_name; diff --git a/core/modules/field_ui/src/Routing/RouteSubscriber.php b/core/modules/field_ui/src/Routing/RouteSubscriber.php index 5fe9f36..3abb6cf 100644 --- a/core/modules/field_ui/src/Routing/RouteSubscriber.php +++ b/core/modules/field_ui/src/Routing/RouteSubscriber.php @@ -41,7 +41,7 @@ public function __construct(EntityManagerInterface $manager) { protected function alterRoutes(RouteCollection $collection) { foreach ($this->manager->getDefinitions() as $entity_type_id => $entity_type) { $defaults = array(); - if ($entity_type->isFieldable() && $route_name = $entity_type->get('field_ui_base_route')) { + if ($route_name = $entity_type->get('field_ui_base_route')) { // Try to get the route from the current collection. if (!$entity_route = $collection->get($route_name)) { continue; diff --git a/core/modules/field_ui/tests/modules/field_ui_test/src/Entity/FieldUITestNoBundle.php b/core/modules/field_ui/tests/modules/field_ui_test/src/Entity/FieldUITestNoBundle.php index e7b2113..ec75368 100644 --- a/core/modules/field_ui/tests/modules/field_ui_test/src/Entity/FieldUITestNoBundle.php +++ b/core/modules/field_ui/tests/modules/field_ui_test/src/Entity/FieldUITestNoBundle.php @@ -18,8 +18,7 @@ * entity_keys = { * "id" = "id", * "uuid" = "uuid", - * }, - * fieldable = TRUE + * } * ) */ class FieldUITestNoBundle extends EntityTest { diff --git a/core/modules/menu_link_content/src/Entity/MenuLinkContent.php b/core/modules/menu_link_content/src/Entity/MenuLinkContent.php index c39d156..55f3489 100644 --- a/core/modules/menu_link_content/src/Entity/MenuLinkContent.php +++ b/core/modules/menu_link_content/src/Entity/MenuLinkContent.php @@ -31,7 +31,6 @@ * admin_permission = "administer menu", * base_table = "menu_link_content", * data_table = "menu_link_content_data", - * fieldable = TRUE, * translatable = TRUE, * entity_keys = { * "id" = "id", diff --git a/core/modules/node/src/Entity/Node.php b/core/modules/node/src/Entity/Node.php index ef8c23b..b01ae1e 100644 --- a/core/modules/node/src/Entity/Node.php +++ b/core/modules/node/src/Entity/Node.php @@ -41,7 +41,6 @@ * data_table = "node_field_data", * revision_table = "node_revision", * revision_data_table = "node_field_revision", - * fieldable = TRUE, * translatable = TRUE, * entity_keys = { * "id" = "nid", diff --git a/core/modules/rest/src/LinkManager/RelationLinkManager.php b/core/modules/rest/src/LinkManager/RelationLinkManager.php index 8a56fa8..04ed8ee 100644 --- a/core/modules/rest/src/LinkManager/RelationLinkManager.php +++ b/core/modules/rest/src/LinkManager/RelationLinkManager.php @@ -9,6 +9,7 @@ use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; +use Drupal\Core\Entity\ContentEntityTypeInterface; use Drupal\Core\Entity\EntityManagerInterface; class RelationLinkManager implements RelationLinkManagerInterface{ @@ -87,7 +88,7 @@ protected function writeCache() { $data = array(); foreach ($this->entityManager->getDefinitions() as $entity_type) { - if ($entity_type->isFieldable()) { + if ($entity_type instanceof ContentEntityTypeInterface) { foreach ($this->entityManager->getBundleInfo($entity_type->id()) as $bundle => $bundle_info) { foreach ($this->entityManager->getFieldDefinitions($entity_type->id(), $bundle) as $field_definition) { $relation_uri = $this->getRelationUri($entity_type->id(), $bundle, $field_definition->getName()); diff --git a/core/modules/shortcut/src/Entity/Shortcut.php b/core/modules/shortcut/src/Entity/Shortcut.php index a3e15e7d..df96d6f 100644 --- a/core/modules/shortcut/src/Entity/Shortcut.php +++ b/core/modules/shortcut/src/Entity/Shortcut.php @@ -45,8 +45,7 @@ * "delete-form" = "entity.shortcut.delete_form", * "edit-form" = "entity.shortcut.canonical", * }, - * bundle_entity_type = "shortcut_set", - * field_ui_base_route = "entity.shortcut.canonical", + * bundle_entity_type = "shortcut_set" * ) */ class Shortcut extends ContentEntityBase implements ShortcutInterface { diff --git a/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php b/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php index 1627b60..453e465 100644 --- a/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php +++ b/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php @@ -35,7 +35,6 @@ class ShortcutTranslationUITest extends ContentTranslationUITest { protected function setUp() { $this->entityTypeId = 'shortcut'; $this->bundle = 'default'; - $this->fieldName = 'title'; parent::setUp(); } @@ -54,6 +53,13 @@ protected function createEntity($values, $langcode, $bundle_name = NULL) { return parent::createEntity($values, $langcode, $bundle_name); } + /** + * {@inheritdoc} + */ + protected function getNewEntityValues($langcode) { + return array('title' => array(array('value' => $this->randomMachineName()))) + parent::getNewEntityValues($langcode); + } + protected function doTestBasicTranslation() { parent::doTestBasicTranslation(); diff --git a/core/modules/system/entity.api.php b/core/modules/system/entity.api.php index 18d9828..a50f3e4 100644 --- a/core/modules/system/entity.api.php +++ b/core/modules/system/entity.api.php @@ -1739,21 +1739,19 @@ function hook_entity_bundle_field_info_alter(&$fields, \Drupal\Core\Entity\Entit */ function hook_entity_field_storage_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) { // Expose storage definitions for all exposed bundle fields. - if ($entity_type->isFieldable()) { - // Query by filtering on the ID as this is more efficient than filtering - // on the entity_type property directly. - $ids = \Drupal::entityQuery('field_storage_config') - ->condition('id', $entity_type->id() . '.', 'STARTS_WITH') - ->execute(); + // Query by filtering on the ID as this is more efficient than filtering + // on the entity_type property directly. + $ids = \Drupal::entityQuery('field_storage_config') + ->condition('id', $entity_type->id() . '.', 'STARTS_WITH') + ->execute(); - // Fetch all fields and key them by field name. - $field_storages = entity_load_multiple('field_storage_config', $ids); - $result = array(); - foreach ($field_storages as $field_storage) { - $result[$field_storage->getName()] = $field_storage; - } - return $result; + // Fetch all fields and key them by field name. + $field_storages = entity_load_multiple('field_storage_config', $ids); + $result = array(); + foreach ($field_storages as $field_storage) { + $result[$field_storage->getName()] = $field_storage; } + return $result; } /** diff --git a/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php b/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php index b7299a5..33d8fc6 100644 --- a/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php +++ b/core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php @@ -60,11 +60,12 @@ protected function setUp() { // Create an entity. $this->entity = $this->createEntity(); - // If this is a fieldable entity, then add a configurable field. We will use - // this configurable field in later tests to ensure that modifications to - // field configuration invalidate render cache entries. - if ($this->entity->getEntityType()->isFieldable()) { - // Add field, so we can modify the Field and Field entities to + // If this is an entity with field UI enabled, then add a configurable + // field. We will use this configurable field in later tests to ensure that + // modifications to field (instance) configuration invalidate render cache + // entries. + if ($this->entity->getEntityType()->get('field_ui_base_route')) { + // Add field, so we can modify the Field and FieldInstance entities to // verify that changes to those indeed clear cache tags. entity_create('field_storage_config', array( 'field_name' => 'configurable_field', @@ -394,7 +395,7 @@ public function testReferencedEntity() { } - if ($this->entity->getEntityType()->isFieldable()) { + if ($this->entity->getEntityType()->get('field_ui_base_route')) { // Verify that after modifying a configurable field on the entity, there // is a cache miss. $this->pass("Test modification of referenced entity's configurable field.", 'Debug'); diff --git a/core/modules/system/src/Tests/Entity/EntityWithUriCacheTagsTestBase.php b/core/modules/system/src/Tests/Entity/EntityWithUriCacheTagsTestBase.php index 4ce93b8..d2ef4dd 100644 --- a/core/modules/system/src/Tests/Entity/EntityWithUriCacheTagsTestBase.php +++ b/core/modules/system/src/Tests/Entity/EntityWithUriCacheTagsTestBase.php @@ -82,7 +82,7 @@ public function testEntityUri() { } - if ($this->entity->getEntityType()->isFieldable()) { + if ($this->entity->getEntityType()->get('field_ui_base_route')) { // Verify that after modifying a configurable field on the entity, there // is a cache miss. $this->pass("Test modification of entity's configurable field.", 'Debug'); diff --git a/core/modules/system/tests/modules/entity_test/entity_test.module b/core/modules/system/tests/modules/entity_test/entity_test.module index bf0cded..06ec1dc 100644 --- a/core/modules/system/tests/modules/entity_test/entity_test.module +++ b/core/modules/system/tests/modules/entity_test/entity_test.module @@ -117,7 +117,7 @@ function entity_test_create_bundle($bundle, $text = NULL, $entity_type = 'entity $bundles += array($bundle => array('label' => $text ? $text : $bundle)); \Drupal::state()->set($entity_type . '.bundles', $bundles); - \Drupal::entityManager()->onBundleCreate($entity_type, $bundle); + \Drupal::entityManager()->onBundleCreate($bundle, $entity_type); } /** @@ -137,7 +137,7 @@ function entity_test_rename_bundle($bundle_old, $bundle_new, $entity_type = 'ent unset($bundles[$bundle_old]); \Drupal::state()->set($entity_type . '.bundles', $bundles); - \Drupal::entityManager()->onBundleRename($entity_type, $bundle_old, $bundle_new); + \Drupal::entityManager()->onBundleRename($bundle_old, $bundle_new, $entity_type); } /** @@ -154,7 +154,7 @@ function entity_test_delete_bundle($bundle, $entity_type = 'entity_test') { unset($bundles[$bundle]); \Drupal::state()->set($entity_type . '.bundles', $bundles); - \Drupal::entityManager()->onBundleDelete($entity_type, $bundle); + \Drupal::entityManager()->onBundleDelete($bundle, $entity_type); } /** diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php index dca9c0d..b4cb26e 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php @@ -33,7 +33,6 @@ * "views_data" = "Drupal\views\EntityViewsData" * }, * base_table = "entity_test", - * fieldable = TRUE, * persistent_cache = FALSE, * entity_keys = { * "id" = "id", diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestBaseFieldDisplay.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestBaseFieldDisplay.php index 84cc5f1..ed213e3 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestBaseFieldDisplay.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestBaseFieldDisplay.php @@ -24,7 +24,6 @@ * "translation" = "Drupal\content_translation\ContentTranslationHandler" * }, * base_table = "entity_test", - * fieldable = TRUE, * entity_keys = { * "id" = "id", * "uuid" = "uuid", diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestCache.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestCache.php index 584a457..96dd6d2 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestCache.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestCache.php @@ -21,7 +21,6 @@ * "translation" = "Drupal\content_translation\ContentTranslationHandler" * }, * base_table = "entity_test", - * fieldable = TRUE, * entity_keys = { * "id" = "id", * "uuid" = "uuid", diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestConstraintViolation.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestConstraintViolation.php index e34bfd7..48b27ab 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestConstraintViolation.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestConstraintViolation.php @@ -21,7 +21,6 @@ * } * }, * base_table = "entity_test", - * fieldable = TRUE, * persistent_cache = FALSE, * entity_keys = { * "id" = "id", diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestDefaultValue.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestDefaultValue.php index 3779567..13189c2 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestDefaultValue.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestDefaultValue.php @@ -17,7 +17,6 @@ * id = "entity_test_default_value", * label = @Translation("Test entity for default values"), * base_table = "entity_test_default_value", - * fieldable = TRUE, * entity_keys = { * "id" = "id", * "uuid" = "uuid", diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestFieldOverride.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestFieldOverride.php index f469275..7632125 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestFieldOverride.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestFieldOverride.php @@ -16,7 +16,6 @@ * id = "entity_test_field_override", * label = @Translation("Test entity field overrides"), * base_table = "entity_test_field_override", - * fieldable = TRUE, * entity_keys = { * "id" = "id", * "uuid" = "uuid", diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestLabelCallback.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestLabelCallback.php index e15d389..1088114 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestLabelCallback.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestLabelCallback.php @@ -16,7 +16,6 @@ * persistent_cache = FALSE, * base_table = "entity_test", * label_callback = "entity_test_label_callback", - * fieldable = TRUE, * entity_keys = { * "id" = "id", * "bundle" = "type" diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMul.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMul.php index 4e03fd1..402936f 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMul.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMul.php @@ -29,7 +29,6 @@ * }, * base_table = "entity_test_mul", * data_table = "entity_test_mul_property_data", - * fieldable = TRUE, * translatable = TRUE, * entity_keys = { * "id" = "id", diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php index 13aca32..b5fc86f 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php @@ -30,7 +30,6 @@ * data_table = "entity_test_mulrev_property_data", * revision_table = "entity_test_mulrev_revision", * revision_data_table = "entity_test_mulrev_property_revision", - * fieldable = TRUE, * translatable = TRUE, * entity_keys = { * "id" = "id", diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestNoId.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestNoId.php index a0daadc..a29c1e2 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestNoId.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestNoId.php @@ -16,7 +16,6 @@ * handlers = { * "storage" = "Drupal\Core\Entity\ContentEntityNullStorage", * }, - * fieldable = TRUE, * entity_keys = { * "bundle" = "type", * }, diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php index f97d2fd..3b40ed9 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php @@ -28,7 +28,6 @@ * }, * base_table = "entity_test_rev", * revision_table = "entity_test_rev_revision", - * fieldable = TRUE, * entity_keys = { * "id" = "id", * "uuid" = "uuid", diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestStringId.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestStringId.php index 98b19b0..9d74938 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestStringId.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestStringId.php @@ -23,8 +23,6 @@ * "translation" = "Drupal\content_translation\ContentTranslationHandler" * }, * base_table = "entity_test_string", - * fieldable = TRUE, - * field_cache = TRUE, * entity_keys = { * "id" = "id", * "uuid" = "uuid", diff --git a/core/modules/taxonomy/src/Entity/Term.php b/core/modules/taxonomy/src/Entity/Term.php index fda4f52..caebc53 100644 --- a/core/modules/taxonomy/src/Entity/Term.php +++ b/core/modules/taxonomy/src/Entity/Term.php @@ -35,7 +35,6 @@ * base_table = "taxonomy_term_data", * data_table = "taxonomy_term_field_data", * uri_callback = "taxonomy_term_uri", - * fieldable = TRUE, * translatable = TRUE, * entity_keys = { * "id" = "tid", diff --git a/core/modules/user/src/Entity/User.php b/core/modules/user/src/Entity/User.php index ee75930..6bb533c 100644 --- a/core/modules/user/src/Entity/User.php +++ b/core/modules/user/src/Entity/User.php @@ -41,7 +41,6 @@ * base_table = "users", * data_table = "users_field_data", * label_callback = "user_format_name", - * fieldable = TRUE, * translatable = TRUE, * entity_keys = { * "id" = "uid",