Commit 3bc31974 authored by alexpott's avatar alexpott

Issue #2079427 by Berdir, andypost, yched: Core/Entity depends on classes /...

Issue #2079427 by Berdir, andypost, yched: Core/Entity depends on classes / functions from field.module
parent 532ff0e2
......@@ -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.
......
......@@ -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);
......
......@@ -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()]);
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\field\Annotation\FieldWidget.
* Contains \Drupal\Core\Field\Annotation\FieldWidget.
*/
namespace Drupal\Core\Field\Annotation;
......
......@@ -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
......
......@@ -27,7 +27,7 @@
* }
* )
*
* @see \Drupal\entity\Tests\ConfigEntityQueryTest
* @see \Drupal\system\Tests\Entity\ConfigEntityQueryTest
*/
class ConfigQueryTest extends ConfigTest {
......
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\entity\Tests\ContentTestTranslationUITest.
* Contains \Drupal\content_translation\Tests\ContentTestTranslationUITest.
*/
namespace Drupal\content_translation\Tests;
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\entity\Tests\ContentTranslationEntityBundleUITest.
* Contains \Drupal\content_translation\Tests\ContentTranslationEntityBundleUITest.
*/
namespace Drupal\content_translation\Tests;
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\entity\Tests\ContentTranslationSyncImageTest.
* Contains \Drupal\content_translation\Tests\ContentTranslationSyncImageTest.
*/
namespace Drupal\content_translation\Tests;
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\entity\Tests\ContentTranslationSyncUnitTest.
* Contains \Drupal\content_translation\Tests\ContentTranslationSyncUnitTest.
*/
namespace Drupal\content_translation\Tests;
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\entity\Tests\ContentTranslationTestBase.
* Contains \Drupal\content_translation\Tests\ContentTranslationTestBase.
*/
namespace Drupal\content_translation\Tests;
......
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\entity\Tests\ContentTranslationUITest.
* Contains \Drupal\content_translation\Tests\ContentTranslationUITest.
*/
namespace Drupal\content_translation\Tests;
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\entity\Tests\ContentTranslationWorkflowsTest.
* Contains \Drupal\content_translation\Tests\ContentTranslationWorkflowsTest.
*/
namespace Drupal\content_translation\Tests;
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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'));
......
......@@ -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'));
......
......@@ -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'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment