diff --git a/core/lib/Drupal/Core/Entity/DisplayComponentHandlerInterface.php b/core/lib/Drupal/Core/Entity/DisplayComponentHandlerInterface.php index f9fce57fe7..f628776e99 100644 --- a/core/lib/Drupal/Core/Entity/DisplayComponentHandlerInterface.php +++ b/core/lib/Drupal/Core/Entity/DisplayComponentHandlerInterface.php @@ -3,7 +3,7 @@ namespace Drupal\Core\Entity; /** - * Provides a base class for DisplayComponent plugins. + * Provides a interface for DisplayComponent plugins. */ interface DisplayComponentHandlerInterface { @@ -16,7 +16,7 @@ interface DisplayComponentHandlerInterface { * @return bool * TRUE if the display component handler provides the component. */ - public function hasElement($name); + public function hasElement($name): bool; /** * Prepares the options before they are stored. @@ -29,7 +29,7 @@ public function hasElement($name); * @return array * Massaged component options. */ - public function preSave($name, array $options); + public function preSave($name, array $options): array; /** * Prepares the display options after they are retrieved from the storage. @@ -42,7 +42,7 @@ public function preSave($name, array $options); * - content: Configured components to render. * - hidden: Configured components to hide from render. */ - public function postLoad(array $properties); + public function postLoad(array $properties): array; /** * Sets the context for the rendering component. @@ -52,10 +52,10 @@ public function postLoad(array $properties); * following parameters should be set: * - entity_type: The type of entity. * - bundle: The entity bundle. - * - view_mode: The entity view mode (default, full). - * - display_context: The type of the display to use (view or form). + * - view_mode: The entity view mode; e.g., 'default', 'full'. + * - display_context: The type of the display to use; e.g., 'view', 'form'. */ - public function setContext(array $context); + public function setContext(array $context): array; /** * Returns the render plugin for the display component. @@ -65,8 +65,8 @@ public function setContext(array $context); * @param array $options * An array of configuration options to instantiate the render plugin. * - * @return mixed - * The object to render the component or null. + * @return Drupal\Core\Entity\Plugin\DisplayComponent\FieldDisplayComponentHandler|null + * The object to render the component or NULL. */ public function getRenderer($name, array $options); diff --git a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php index 6813c50cf4..df89b69aca 100644 --- a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php +++ b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php @@ -122,7 +122,7 @@ abstract class EntityDisplayBase extends ConfigEntityBase implements EntityDispl protected $renderer; /** - * A mapping of display elements and its corresponding handler. + * An array of handlers keyed by their display element names. */ protected $handlers; diff --git a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php index 9da338c096..980f006aa7 100644 --- a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php +++ b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php @@ -88,7 +88,7 @@ class EntityViewBuilder extends EntityHandlerBase implements EntityHandlerInterf protected $entityFieldManager; /** - * The entity field manager. + * The formatter plugin manager. * * @var \Drupal\Core\Field\FormatterPluginManager */ diff --git a/core/lib/Drupal/Core/Entity/Plugin/DisplayComponent/ExtraFieldDisplayComponentHandler.php b/core/lib/Drupal/Core/Entity/Plugin/DisplayComponent/ExtraFieldDisplayComponentHandler.php index 171d6b3406..c043fb426b 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/DisplayComponent/ExtraFieldDisplayComponentHandler.php +++ b/core/lib/Drupal/Core/Entity/Plugin/DisplayComponent/ExtraFieldDisplayComponentHandler.php @@ -11,7 +11,7 @@ * Provides a component handler to manage entity extra fields. * * @DisplayComponent( - * id = "extra_field" + * id = "extra_field", * ) */ class ExtraFieldDisplayComponentHandler extends DisplayComponentHandlerBase implements ContainerFactoryPluginInterface { @@ -24,7 +24,7 @@ class ExtraFieldDisplayComponentHandler extends DisplayComponentHandlerBase impl protected $entityFieldManager; /** - * Constructs a FieldDisplayComponentHandler object. + * Constructs a ExtraFieldDisplayComponentHandler object. * * @param array $configuration * A configuration array containing information about the plugin instance. diff --git a/core/lib/Drupal/Core/Entity/Plugin/DisplayComponent/FieldDisplayComponentHandler.php b/core/lib/Drupal/Core/Entity/Plugin/DisplayComponent/FieldDisplayComponentHandler.php index 18f75d6688..c39c6308c5 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/DisplayComponent/FieldDisplayComponentHandler.php +++ b/core/lib/Drupal/Core/Entity/Plugin/DisplayComponent/FieldDisplayComponentHandler.php @@ -173,6 +173,9 @@ public function hasElement($name) { /** * Returns the field definition of a field. + * + * @return \Drupal\Core\Field\FieldDefinitionInterface + * The field definition. */ protected function getFieldDefinition($field_name) { $definitions = $this->getDisplayableFields(); @@ -181,6 +184,9 @@ protected function getFieldDefinition($field_name) { /** * Returns the definitions of the fields that are candidate for display. + * + * @return array + * Returns the fields definitions. */ protected function getDisplayableFields() { $entity_type = $this->context['entity_type']; diff --git a/core/lib/Drupal/Core/Entity/entity.api.php b/core/lib/Drupal/Core/Entity/entity.api.php index 0c54dbbcc0..ae416f0238 100644 --- a/core/lib/Drupal/Core/Entity/entity.api.php +++ b/core/lib/Drupal/Core/Entity/entity.api.php @@ -2264,7 +2264,7 @@ function hook_entity_extra_field_info_alter(&$info) { * @param string[] $plugins * An array of all the existing plugin definitions, passed by reference. * - * @see DisplayComponentHandlerPluginManager + * @see \Drupal\Core\Entity\DisplayComponentHandlerPluginManager */ function hook_display_component_handler_info_alter(array &$plugins) { $plugins['some_plugin']['label'] = t('Better name');