diff --git a/core/lib/Drupal/Core/Entity/EntityRenderController.php b/core/lib/Drupal/Core/Entity/EntityRenderController.php index 2a1b7a0..53457aa 100644 --- a/core/lib/Drupal/Core/Entity/EntityRenderController.php +++ b/core/lib/Drupal/Core/Entity/EntityRenderController.php @@ -28,11 +28,7 @@ public function __construct($entity_type) { * Implements \Drupal\Core\Entity\EntityRenderControllerInterface::buildContent(). */ public function buildContent(array $entities, array $displays, $view_mode, $langcode = NULL) { - $bc_entities = array(); - foreach ($entities as $entity) { - $bc_entities[$entity->id()] = $entity->getBCEntity(); - } - field_attach_prepare_view($this->entityType, $bc_entities, $displays, $langcode); + field_attach_prepare_view($this->entityType, $entities, $displays, $langcode); module_invoke_all('entity_prepare_view', $this->entityType, $entities, $displays, $view_mode); foreach ($entities as $entity) { @@ -40,7 +36,7 @@ public function buildContent(array $entities, array $displays, $view_mode, $lang $entity->content = array( '#view_mode' => $view_mode, ); - $entity->content += field_attach_view($entity->getBCEntity(), $displays[$entity->bundle()], $langcode); + $entity->content += field_attach_view($entity, $displays[$entity->bundle()], $langcode); } } diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php index ce3f34a..8d49349 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php @@ -9,6 +9,9 @@ /** * Tests the block edit functionality. + * + * @todo Consider removing this test when https://drupal.org/node/1822000 is + * fixed. */ class CustomBlockFieldTest extends CustomBlockTestBase { diff --git a/core/modules/field/field.attach.inc b/core/modules/field/field.attach.inc index 9b24d94..de035d2 100644 --- a/core/modules/field/field.attach.inc +++ b/core/modules/field/field.attach.inc @@ -1337,12 +1337,12 @@ function field_attach_prepare_view($entity_type, array $entities, array $display $prepare = array(); foreach ($entities as $id => $entity) { if (empty($entity->_field_view_prepared)) { - // Add this entity to the items to be prepared. - $prepare[$id] = $entity; - // Enable BC if necessary. $entity = $entity->getBCEntity(); + // Add this entity to the items to be prepared. + $prepare[$id] = $entity; + // Determine the actual language code to display for each field, given the // language codes available in the field data. $options['langcode'][$id] = field_language($entity, NULL, $langcode);