diff --git a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php index 85e5189..4a207a6 100644 --- a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php +++ b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php @@ -252,14 +252,15 @@ public function entityViewBuilderBuildMultiple(array $build) { if (isset($build[$key][$entity_type_key])) { $entity = $build[$key][$entity_type_key]; if ($entity instanceof ContentEntityInterface) { - array_push($entity_keys, $key); + $entity_keys[] = $key; } } } // Store entities for rendering by view_mode. foreach($entity_keys as $key) { - $view_modes[$build[$key]['#view_mode']][$build[$key][$entity_type_key]->id()] = $entity; + $entity = $build[$key][$entity_type_key]; + $view_modes[$build[$key]['#view_mode']][$key] = $entity; } // Build content for the displays represented by the entities.