diff --git a/core/modules/entity/lib/Drupal/entity/Entity/EntityViewDisplay.php b/core/modules/entity/lib/Drupal/entity/Entity/EntityViewDisplay.php index 7ba4d6e..78fc372 100644 --- a/core/modules/entity/lib/Drupal/entity/Entity/EntityViewDisplay.php +++ b/core/modules/entity/lib/Drupal/entity/Entity/EntityViewDisplay.php @@ -179,7 +179,7 @@ public function buildMultiple(array $entities) { } // Run field formatters. - foreach ($this->getFieldDefinitions() as $field_name => $definition) { + foreach (\Drupal::entityManager()->getFieldDefinitions($this->targetEntityType, $this->bundle) as $field_name => $definition) { if ($formatter = $this->getRenderer($field_name)) { // Group items across all entities and pass them to the formatter's // prepareView() method. diff --git a/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php b/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php index 1121175..cf58ec9 100644 --- a/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php +++ b/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php @@ -209,6 +209,10 @@ public function toArray() { } // Let the component handlers add missing components. + if (!$this->handlerManager) { + // @todo fix serialization, this used in __wakeup() + $this->handlerManager = \Drupal::service('plugin.manager.entity.display_component_handler'); + } $handlers = $this->handlerManager->getDefinitions(); foreach (array_keys($handlers) as $type) { $properties = $this->getComponentHandler($type)->massageOut($properties);