You are here

public function Section::getLayout in Drupal 10

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

Gets the layout plugin for this section.

Parameters

\Drupal\Core\Plugin\Context\ContextInterface[] $contexts: An array of available contexts.

Return value

\Drupal\Core\Layout\LayoutInterface The layout plugin.

2 calls to Section::getLayout()
Section::getLayoutSettings in core/modules/layout_builder/src/Section.php
Gets the layout plugin settings for this section.
Section::toRenderArray in core/modules/layout_builder/src/Section.php
Returns the renderable array for this section.

File

core/modules/layout_builder/src/Section.php, line 109

Class

Section
Provides a domain object for layout sections.

Namespace

Drupal\layout_builder

Code

public function getLayout(array $contexts = []) {
  $layout = $this
    ->layoutPluginManager()
    ->createInstance($this
    ->getLayoutId(), $this->layoutSettings);
  if ($contexts) {
    $this
      ->contextHandler()
      ->applyContextMapping($layout, $contexts);
  }
  return $layout;
}