function LayoutDefault::build

Same name in other branches
  1. 9 core/lib/Drupal/Core/Layout/LayoutDefault.php \Drupal\Core\Layout\LayoutDefault::build()
  2. 8.9.x core/lib/Drupal/Core/Layout/LayoutDefault.php \Drupal\Core\Layout\LayoutDefault::build()
  3. 11.x core/lib/Drupal/Core/Layout/LayoutDefault.php \Drupal\Core\Layout\LayoutDefault::build()

Overrides LayoutInterface::build

4 calls to LayoutDefault::build()
LayoutBuilderTestPlugin::build in core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Layout/LayoutBuilderTestPlugin.php
Build a render array for layout with regions.
MultiWidthLayoutBase::build in core/modules/layout_builder/src/Plugin/Layout/MultiWidthLayoutBase.php
Build a render array for layout with regions.
NavigationLayout::build in core/modules/navigation/src/NavigationLayout.php
Build a render array for layout with regions.
TestContextAwareLayout::build in core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Layout/TestContextAwareLayout.php
Build a render array for layout with regions.
5 methods override LayoutDefault::build()
BlankLayout::build in core/modules/layout_builder/src/Plugin/Layout/BlankLayout.php
Build a render array for layout with regions.
LayoutBuilderTestPlugin::build in core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Layout/LayoutBuilderTestPlugin.php
Build a render array for layout with regions.
MultiWidthLayoutBase::build in core/modules/layout_builder/src/Plugin/Layout/MultiWidthLayoutBase.php
Build a render array for layout with regions.
NavigationLayout::build in core/modules/navigation/src/NavigationLayout.php
Build a render array for layout with regions.
TestContextAwareLayout::build in core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Layout/TestContextAwareLayout.php
Build a render array for layout with regions.

File

core/lib/Drupal/Core/Layout/LayoutDefault.php, line 46

Class

LayoutDefault
Provides a default class for Layout plugins.

Namespace

Drupal\Core\Layout

Code

public function build(array $regions) {
    // Ensure $build only contains defined regions and in the order defined.
    $build = [];
    foreach ($this->getPluginDefinition()
        ->getRegionNames() as $region_name) {
        if (array_key_exists($region_name, $regions)) {
            $build[$region_name] = $regions[$region_name];
        }
    }
    $build['#in_preview'] = $this->inPreview;
    $build['#settings'] = $this->getConfiguration();
    $build['#layout'] = $this->pluginDefinition;
    $build['#theme'] = $this->pluginDefinition
        ->getThemeHook();
    if ($library = $this->pluginDefinition
        ->getLibrary()) {
        $build['#attached']['library'][] = $library;
    }
    return $build;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.