diff --git a/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php b/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php index 6339c18..3581cbe 100644 --- a/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php +++ b/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php @@ -153,16 +153,16 @@ public function buildForm(ContentEntityInterface $entity, array &$form, FormStat $form += array('#parents' => array()); // Let each widget generate the form elements. - foreach ($entity as $name => $items) { - if ($widget = $this->getRenderer($name)) { + foreach ($entity->getFields() as $field_name => $items) { + if ($widget = $this->getRenderer($field_name)) { $items->filterEmptyItems(); - $form[$name] = $widget->form($items, $form, $form_state); - $form[$name]['#access'] = $items->access('edit'); + $form[$field_name] = $widget->form($items, $form, $form_state); + $form[$field_name]['#access'] = $items->access('edit'); // Assign the correct weight. This duplicates the reordering done in // processForm(), but is needed for other forms calling this method // directly. - $form[$name]['#weight'] = $this->getComponent($name)['weight']; + $form[$field_name]['#weight'] = $this->getComponent($field_name)['weight']; } } diff --git a/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php index 800538d..562b9cc 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php +++ b/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\Core\Entity\Plugin\DataType\Entity. + * Contains \Drupal\Core\Entity\Plugin\DataType\EntityAdapter. */ namespace Drupal\Core\Entity\Plugin\DataType; diff --git a/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/TaxonomyFormatterBase.php b/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/TaxonomyFormatterBase.php index 8343d3d..3c140cc 100644 --- a/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/TaxonomyFormatterBase.php +++ b/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/TaxonomyFormatterBase.php @@ -27,7 +27,7 @@ public function prepareView(array $entities_items) { /* @var \Drupal\Core\Field\EntityReferenceFieldItemList $items */ foreach ($entities_items as $items) { /* @var \Drupal\Core\Entity\ContentEntityBase $parent */ - $parent = $items->getParent(); + $parent = $items->getEntity(); $active_langcode = $parent->language()->getId(); /* @var \Drupal\taxonomy\Entity\Term $term */ foreach ($items->referencedEntities() as $term) { diff --git a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php index 168f86e..d951f75 100644 --- a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php @@ -140,7 +140,7 @@ protected function setUp() { $this->typedDataManager->expects($this->any()) ->method('getDefinition') ->with('entity') - ->will($this->returnValue(['class' => '\Drupal\Core\Entity\Plugin\DataType\Entity'])); + ->will($this->returnValue(['class' => '\Drupal\Core\Entity\Plugin\DataType\EntityAdapter'])); $english = new Language(array('id' => 'en')); $not_specified = new Language(array('id' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'locked' => TRUE)); diff --git a/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php index 74b9b44..5556c6e 100644 --- a/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php @@ -149,7 +149,7 @@ protected function setUp() { $this->typedDataManager->expects($this->any()) ->method('getDefinition') ->with('entity') - ->will($this->returnValue(['class' => '\Drupal\Core\Entity\Plugin\DataType\Entity'])); + ->will($this->returnValue(['class' => '\Drupal\Core\Entity\Plugin\DataType\EntityAdapter'])); $this->typedDataManager->expects($this->any()) ->method('getDefaultConstraints') ->willReturn([]);