You are here

public function LayoutBuilderEntityViewDisplay::getComponent in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay::getComponent()
  2. 9 core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay::getComponent()

Gets the display options set for a component.

Parameters

string $name: The name of the component.

Return value

array|null The display options for the component, or NULL if the component is not displayed.

Overrides EntityDisplayBase::getComponent

1 call to LayoutBuilderEntityViewDisplay::getComponent()
QuickEditLayoutBuilderEntityViewDisplay::getComponent in core/modules/quickedit/src/Entity/QuickEditLayoutBuilderEntityViewDisplay.php
Gets the display options set for a component.
1 method overrides LayoutBuilderEntityViewDisplay::getComponent()
QuickEditLayoutBuilderEntityViewDisplay::getComponent in core/modules/quickedit/src/Entity/QuickEditLayoutBuilderEntityViewDisplay.php
Gets the display options set for a component.

File

core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php, line 474

Class

LayoutBuilderEntityViewDisplay
Provides an entity view display entity that has a layout.

Namespace

Drupal\layout_builder\Entity

Code

public function getComponent($name) {
  if ($this
    ->isLayoutBuilderEnabled() && ($section_component = $this
    ->getSectionComponentForFieldName($name))) {
    $plugin = $section_component
      ->getPlugin();
    if ($plugin instanceof ConfigurableInterface) {
      $configuration = $plugin
        ->getConfiguration();
      if (isset($configuration['formatter'])) {
        return $configuration['formatter'];
      }
    }
  }
  return parent::getComponent($name);
}