function LayoutDefault::build

Same name in other branches
  1. 9 core/lib/Drupal/Core/Layout/LayoutDefault.php \Drupal\Core\Layout\LayoutDefault::build()
  2. 10 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

2 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.
3 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.

File

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

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['#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.