diff -u b/core/core.services.yml b/core/core.services.yml --- b/core/core.services.yml +++ b/core/core.services.yml @@ -1742,10 +1742,9 @@ - { name: event_subscriber } response_filter.rss.relative_url: class: Drupal\Core\EventSubscriber\RssResponseRelativeUrlFilter - tags: - plugin.manager.entity.display_component_handler: - class: Drupal\Core\Entity\DisplayComponentHandlerPluginManager - parent: default_plugin_manager + plugin.manager.entity.display_component_handler: + class: Drupal\Core\Entity\DisplayComponentHandlerPluginManager + parent: default_plugin_manager messenger: class: Drupal\Core\Messenger\Messenger arguments: ['@session.flash_bag', '@page_cache_kill_switch'] diff -u b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php --- b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php +++ b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php @@ -79,13 +79,14 @@ protected $hidden = []; /** - * * The renderer objects used for this display, keyed by component name. + * The renderer objects used for this display, keyed by component name. + * + * @var array */ - protected $renderers = array(); + protected $renderers = []; /** - * The original view or form mode that was requested (case of view/form modes - * being configured to fall back to the 'default' display). + * The original view or form mode that was requested. * * @var string */ @@ -120,15 +121,17 @@ protected $renderer; /** - * * A mapping of display elements and its corresponding handler. + * A mapping of display elements and its corresponding handler. + * + * @var \Drupal\Core\Entity\DisplayComponentHandlerInterface */ protected $handlers; /** - * The display component handler plugin manager. - * - * @var \Drupal\Core\Entity\DisplayComponentHandlerPluginManager - */ + * The display component handler plugin manager. + * + * @var array + */ protected $handlerManager; /** @@ -404,7 +407,14 @@ } // Let other modules feedback about their own additions. - $weights = array_merge($weights, \Drupal::moduleHandler()->invokeAll('field_info_max_weight', [$this->targetEntityType, $this->bundle, $this->displayContext, $this->mode])); + $weights = array_merge($weights, \Drupal::moduleHandler()->invokeAll('field_info_max_weight', + [ + $this->targetEntityType, + $this->bundle, + $this->displayContext, + $this->mode, + ]) + ); return $weights ? max($weights) : NULL; } @@ -426,7 +436,9 @@ // For "official" view modes and form modes, ignore fields whose // definition states they should not be displayed. if ($this->mode !== static::CUSTOM_MODE) { - $definitions = array_filter($definitions, [$this, 'fieldHasDisplayOptions']); + $definitions = array_filter($definitions, + [$this, 'fieldHasDisplayOptions'] + ); } $this->fieldDefinitions = $definitions; } @@ -441,6 +453,7 @@ * A field definition. * * @return array|null + * The display option or NULL if there is no display option. */ private function fieldHasDisplayOptions(FieldDefinitionInterface $definition) { // The display only cares about fields that specify display options. @@ -601,6 +614,7 @@ * The element name. * * @return \Drupal\Core\Entity\DisplayComponentHandlerInterface + * The component handler. */ public function getComponentHandlerByElementName($name) { if (!isset($this->handlers[$name])) { @@ -625,21 +639,24 @@ * The type of component handler (field, extra_field). * * @return \Drupal\Core\Entity\DisplayComponentHandlerInterface + * The component handler. */ public function getComponentHandler($type) { - $handler = $this->handlerManager->getInstance(array('type' => $type)); + $handler = $this->handlerManager->getInstance(['type' => $type]); if ($handler) { - $handler->setContext(array( - 'entity_type' => $this->targetEntityType, - 'bundle' => $this->bundle, - 'mode' => $this->originalMode, - 'display_context' => $this->displayContext, - )); + $handler->setContext( + [ + 'entity_type' => $this->targetEntityType, + 'bundle' => $this->bundle, + 'mode' => $this->originalMode, + 'display_context' => $this->displayContext, + ] + ); } return $handler; } - /**+ + /** * {@inheritdoc} */ public function getRenderer($name) {