You are here

public function LayoutBase::build in Layout Plugin (obsolete, use core's Layout Discovery) 8

Build a render array for layout with regions.

Parameters

array $regions: An associative array keyed by region name, containing render arrays representing the content that should be placed in each region.

Return value

array Render array for the layout with regions.

Overrides LayoutInterface::build

File

src/Plugin/Layout/LayoutBase.php, line 118

Class

LayoutBase
Provides a base class for Layout plugins.

Namespace

Drupal\layout_plugin\Plugin\Layout

Code

public function build(array $regions) {
  $build = array_intersect_key($regions, $this
    ->getRegionDefinitions());
  $build['#layout'] = $this
    ->getPluginDefinition();
  $build['#settings'] = $this
    ->getConfiguration();
  if ($theme = $this
    ->getThemeHook()) {
    $build['#theme'] = $theme;
  }
  if ($library = $this
    ->getLibrary()) {
    $build['#attached']['library'][] = $library;
  }
  return $build;
}