diff --git a/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php b/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php index dfe912e545c5f7c63945d9e883976a8be5328e5f..882286ad90405383899c99e2279c684669843016 100644 --- a/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php +++ b/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php @@ -192,7 +192,7 @@ public function buildForm(FieldableEntityInterface $entity, array &$form, FormSt /** * Process callback: assigns weights and hides extra fields. * - * @see \Drupal\entity\Entity\EntityFormDisplay::buildForm() + * @see \Drupal\Core\Entity\Entity\EntityFormDisplay::buildForm() */ public function processForm($element, FormStateInterface $form_state, $form) { // Assign the weights configured in the form display. diff --git a/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php b/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php index 79c0f13d72e058ead30be73f0b30e126d0747321..efffdbc03e6c33297ff28195833e3f032d485008 100644 --- a/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php +++ b/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php @@ -152,7 +152,7 @@ public static function collectRenderDisplays($entities, $view_mode) { * @return \Drupal\Core\Entity\Display\EntityViewDisplayInterface * The display object that should be used to render the entity. * - * @see \Drupal\entity\Entity\EntityDisplay::collectRenderDisplays() + * @see \Drupal\Core\Entity\Entity\EntityViewDisplay::collectRenderDisplays() */ public static function collectRenderDisplay(FieldableEntityInterface $entity, $view_mode) { $displays = static::collectRenderDisplays(array($entity), $view_mode); diff --git a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php index 96fa0de94cd7df36eac34878546e59fe9e18db63..39e953fb8777b51069f1f77d590088253acde177 100644 --- a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php +++ b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php @@ -8,10 +8,9 @@ namespace Drupal\Core\Entity; use Drupal\Core\Config\Entity\ConfigEntityBase; +use Drupal\Core\Config\Entity\ConfigEntityInterface; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Entity\Display\EntityDisplayInterface; -use Drupal\field\Entity\FieldConfig; -use Drupal\field\FieldConfigInterface; use Drupal\Component\Utility\SafeMarkup; /** @@ -262,14 +261,20 @@ public function calculateDependencies() { // Depend on the provider of the entity type. $this->addDependency('module', $target_entity_type->getProvider()); } - // Create dependencies on both hidden and visible fields. - $fields = $this->content + $this->hidden; - foreach ($fields as $field_name => $component) { - $field = FieldConfig::loadByName($this->targetEntityType, $this->bundle, $field_name); - if ($field) { - $this->addDependency('config', $field->getConfigDependencyName()); + + // If field.module is enabled, add dependencies on 'field_config' entities + // for both displayed and hidden fields. We intentionally leave out base + // field overrides, since the field still exists without them. + if (\Drupal::moduleHandler()->moduleExists('field')) { + $components = $this->content + $this->hidden; + $field_definitions = $this->entityManager()->getFieldDefinitions($this->targetEntityType, $this->bundle); + foreach (array_intersect_key($field_definitions, $components) as $field_name => $field_definition) { + if ($field_definition instanceof ConfigEntityInterface && $field_definition->getEntityTypeId() == 'field_config') { + $this->addDependency('config', $field_definition->getConfigDependencyName()); + } } } + // Depend on configured modes. if ($this->mode != 'default') { $mode_entity = $this->entityManager()->getStorage('entity_' . $this->displayContext . '_mode')->load($target_entity_type->id() . '.' . $this->mode); @@ -417,7 +422,7 @@ private function fieldHasDisplayOptions(FieldDefinitionInterface $definition) { public function onDependencyRemoval(array $dependencies) { $changed = parent::onDependencyRemoval($dependencies); foreach ($dependencies['config'] as $entity) { - if ($entity instanceof FieldConfigInterface) { + if ($entity->getEntityTypeId() == 'field_config') { // Remove components for fields that are being deleted. $this->removeComponent($entity->getName()); unset($this->hidden[$entity->getName()]); diff --git a/core/lib/Drupal/Core/Field/Annotation/FieldWidget.php b/core/lib/Drupal/Core/Field/Annotation/FieldWidget.php index 542ed0b37fecaeb527eb1421306597567248cf96..5ca352edaa2c8f84a3365c817e79f5c92e1a2435 100644 --- a/core/lib/Drupal/Core/Field/Annotation/FieldWidget.php +++ b/core/lib/Drupal/Core/Field/Annotation/FieldWidget.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\field\Annotation\FieldWidget. + * Contains \Drupal\Core\Field\Annotation\FieldWidget. */ namespace Drupal\Core\Field\Annotation; diff --git a/core/lib/Drupal/Core/Field/FieldItemInterface.php b/core/lib/Drupal/Core/Field/FieldItemInterface.php index 2479ca3f30fcc733e2965cdf5f23feb94c957d52..a2339acacb0c55df89179590784acf9454b84c24 100644 --- a/core/lib/Drupal/Core/Field/FieldItemInterface.php +++ b/core/lib/Drupal/Core/Field/FieldItemInterface.php @@ -80,10 +80,10 @@ public static function mainPropertyName(); * Only columns that appear in the 'columns' array are allowed. * - indexes: (optional) An array of Schema API index definitions. Only * columns that appear in the 'columns' array are allowed. Those indexes - * will be used as default indexes. Callers of field_create_field() can - * specify additional indexes or, at their own risk, modify the default - * indexes specified by the field-type module. Some storage engines might - * not support indexes. + * will be used as default indexes. Field definitions can specify + * additional indexes or, at their own risk, modify the default indexes + * specified by the field-type module. Some storage engines might not + * support indexes. * - foreign keys: (optional) An array of Schema API foreign key * definitions. Note, however, that the field data is not necessarily * stored in SQL. Also, the possible usage is limited, as you cannot diff --git a/core/modules/config/tests/config_test/src/Entity/ConfigQueryTest.php b/core/modules/config/tests/config_test/src/Entity/ConfigQueryTest.php index 022b1f1360fb9c53ddd2c2d02241a68be305f684..06212443963133286f32e2125abd2b6a85417f58 100644 --- a/core/modules/config/tests/config_test/src/Entity/ConfigQueryTest.php +++ b/core/modules/config/tests/config_test/src/Entity/ConfigQueryTest.php @@ -27,7 +27,7 @@ * } * ) * - * @see \Drupal\entity\Tests\ConfigEntityQueryTest + * @see \Drupal\system\Tests\Entity\ConfigEntityQueryTest */ class ConfigQueryTest extends ConfigTest { diff --git a/core/modules/content_translation/src/Tests/ContentTestTranslationUITest.php b/core/modules/content_translation/src/Tests/ContentTestTranslationUITest.php index aa499159c718a7e8c31186728b4c900170087a88..0db24c8b704df4851e5168dab0edc88bf5eed4b5 100644 --- a/core/modules/content_translation/src/Tests/ContentTestTranslationUITest.php +++ b/core/modules/content_translation/src/Tests/ContentTestTranslationUITest.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\entity\Tests\ContentTestTranslationUITest. + * Contains \Drupal\content_translation\Tests\ContentTestTranslationUITest. */ namespace Drupal\content_translation\Tests; diff --git a/core/modules/content_translation/src/Tests/ContentTranslationEntityBundleUITest.php b/core/modules/content_translation/src/Tests/ContentTranslationEntityBundleUITest.php index 5a1ac836d91a9e1cd45d16796f60ae8ee6cc7445..2c432c4c3781b3b8cf951b607ae5a360bce9f6d3 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationEntityBundleUITest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationEntityBundleUITest.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\entity\Tests\ContentTranslationEntityBundleUITest. + * Contains \Drupal\content_translation\Tests\ContentTranslationEntityBundleUITest. */ namespace Drupal\content_translation\Tests; diff --git a/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php b/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php index f1b7688a5fb26949dc98c2c321756711fd4414c2..606b5b34c14aad74d951ee7fe10232e85e104331 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\entity\Tests\ContentTranslationSyncImageTest. + * Contains \Drupal\content_translation\Tests\ContentTranslationSyncImageTest. */ namespace Drupal\content_translation\Tests; diff --git a/core/modules/content_translation/src/Tests/ContentTranslationSyncUnitTest.php b/core/modules/content_translation/src/Tests/ContentTranslationSyncUnitTest.php index a15977a88bea6c8c68550e6f9e632c29234d3742..53c5b0ac2f8ac3212afb4a5174763905cd6989d0 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationSyncUnitTest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationSyncUnitTest.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\entity\Tests\ContentTranslationSyncUnitTest. + * Contains \Drupal\content_translation\Tests\ContentTranslationSyncUnitTest. */ namespace Drupal\content_translation\Tests; diff --git a/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php b/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php index a9d2c5ba40ba90c0cb88d60d71c4b4f067a37caf..d00b3789a29a0416badb84a8fe2698e62c12a99d 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\entity\Tests\ContentTranslationTestBase. + * Contains \Drupal\content_translation\Tests\ContentTranslationTestBase. */ namespace Drupal\content_translation\Tests; diff --git a/core/modules/content_translation/src/Tests/ContentTranslationUITest.php b/core/modules/content_translation/src/Tests/ContentTranslationUITest.php index 0ec3280b3224b51e8281d4d6d6a0b339c40b8ce0..5a7429cafd2461509667e8b94f6fadc2f675cf4e 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationUITest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationUITest.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\entity\Tests\ContentTranslationUITest. + * Contains \Drupal\content_translation\Tests\ContentTranslationUITest. */ namespace Drupal\content_translation\Tests; diff --git a/core/modules/content_translation/src/Tests/ContentTranslationWorkflowsTest.php b/core/modules/content_translation/src/Tests/ContentTranslationWorkflowsTest.php index 76470a72656423c447674a5772aac3de589d15fb..62daf7557e015fa20a9397a031a54ebc33d386e6 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationWorkflowsTest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationWorkflowsTest.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\entity\Tests\ContentTranslationWorkflowsTest. + * Contains \Drupal\content_translation\Tests\ContentTranslationWorkflowsTest. */ namespace Drupal\content_translation\Tests; diff --git a/core/modules/field_ui/src/Access/FormModeAccessCheck.php b/core/modules/field_ui/src/Access/FormModeAccessCheck.php index 055f588b09bbb5f761dc63da3eaf15313a23e640..35c83f9efe02cae33d49dac7e2b0072918d8d7ab 100644 --- a/core/modules/field_ui/src/Access/FormModeAccessCheck.php +++ b/core/modules/field_ui/src/Access/FormModeAccessCheck.php @@ -17,7 +17,7 @@ /** * Defines an access check for entity form mode routes. * - * @see \Drupal\entity\Entity\EntityFormMode + * @see \Drupal\Core\Entity\Entity\EntityFormMode */ class FormModeAccessCheck implements AccessInterface { diff --git a/core/modules/field_ui/src/Access/ViewModeAccessCheck.php b/core/modules/field_ui/src/Access/ViewModeAccessCheck.php index a3e5e469a75b57505da22c41e615cf0cc4883116..6e764a383a2b73a7f0bcdf709b2cb45bf8f00053 100644 --- a/core/modules/field_ui/src/Access/ViewModeAccessCheck.php +++ b/core/modules/field_ui/src/Access/ViewModeAccessCheck.php @@ -17,7 +17,7 @@ /** * Defines an access check for entity view mode routes. * - * @see \Drupal\entity\Entity\EntityViewMode + * @see \Drupal\Core\Entity\Entity\EntityViewMode */ class ViewModeAccessCheck implements AccessInterface { diff --git a/core/modules/field_ui/src/EntityDisplayModeListBuilder.php b/core/modules/field_ui/src/EntityDisplayModeListBuilder.php index 6dc915438386644d64078c5ff778561364662148..f17a07669dc36b0e82e28c9e78dc3db5e4c3fa42 100644 --- a/core/modules/field_ui/src/EntityDisplayModeListBuilder.php +++ b/core/modules/field_ui/src/EntityDisplayModeListBuilder.php @@ -17,7 +17,7 @@ /** * Defines a class to build a listing of view mode entities. * - * @see \Drupal\entity\Entity\EntityViewMode + * @see \Drupal\Core\Entity\Entity\EntityViewMode */ class EntityDisplayModeListBuilder extends ConfigEntityListBuilder { diff --git a/core/modules/field_ui/src/EntityFormModeListBuilder.php b/core/modules/field_ui/src/EntityFormModeListBuilder.php index 8515265647f3baf6f83ebf9f3ea69f787871e177..f6fc24b47fc9f1a0e7dc4d7ec7bb49661265bb59 100644 --- a/core/modules/field_ui/src/EntityFormModeListBuilder.php +++ b/core/modules/field_ui/src/EntityFormModeListBuilder.php @@ -10,7 +10,7 @@ /** * Defines a class to build a listing of form mode entities. * - * @see \Drupal\entity\Entity\EntityFormMode + * @see \Drupal\Core\Entity\Entity\EntityFormMode */ class EntityFormModeListBuilder extends EntityDisplayModeListBuilder { diff --git a/core/modules/field_ui/src/Tests/EntityDisplayTest.php b/core/modules/field_ui/src/Tests/EntityDisplayTest.php index 05f2cc4d173fc2077320d0c3c53725ed61167927..495b8e778540039458ec570dea3730774924717c 100644 --- a/core/modules/field_ui/src/Tests/EntityDisplayTest.php +++ b/core/modules/field_ui/src/Tests/EntityDisplayTest.php @@ -391,7 +391,7 @@ public function testDeleteField() { } /** - * Tests \Drupal\entity\EntityDisplayBase::onDependencyRemoval(). + * Tests \Drupal\Core\Entity\EntityDisplayBase::onDependencyRemoval(). */ public function testOnDependencyRemoval() { $this->enableModules(array('field_plugins_test')); diff --git a/core/modules/field_ui/src/Tests/EntityFormDisplayTest.php b/core/modules/field_ui/src/Tests/EntityFormDisplayTest.php index 6e84b95c610cac8c04e889a42f14e900ef290e31..1e5ac237b4c1574b2030f7a1205738f58385e06c 100644 --- a/core/modules/field_ui/src/Tests/EntityFormDisplayTest.php +++ b/core/modules/field_ui/src/Tests/EntityFormDisplayTest.php @@ -224,7 +224,7 @@ public function testDeleteField() { } /** - * Tests \Drupal\entity\EntityDisplayBase::onDependencyRemoval(). + * Tests \Drupal\Core\Entity\EntityDisplayBase::onDependencyRemoval(). */ public function testOnDependencyRemoval() { $this->enableModules(array('field_plugins_test')); 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 a084b130cd907a72909179e7a30833433a670117..164a7c0ac84640b477cef3cf0fe6bc093082505d 100644 --- a/core/modules/system/tests/modules/entity_test/entity_test.module +++ b/core/modules/system/tests/modules/entity_test/entity_test.module @@ -236,7 +236,7 @@ function entity_test_entity_extra_field_info() { $extra['entity_test']['bundle_with_extra_fields'] = array( 'display' => array( // Note: those extra fields do not currently display anything, they are - // just used in \Drupal\entity\Tests\EntityDisplayTest to test the + // just used in \Drupal\field_ui\Tests\EntityDisplayTest to test the // behavior of entity display objects. 'display_extra_field' => array( 'label' => t('Display extra field'),