You are here

public function LayoutBuilderDisplayVariant::build in Page Manager 8.4

Builds and returns the renderable array for the display variant.

The variant can contain cacheability metadata for the configuration that was passed in setConfiguration(). In the build() method, this should be added to the render array that is returned.

Return value

array A render array for the display variant.

Overrides VariantInterface::build

File

src/Plugin/DisplayVariant/LayoutBuilderDisplayVariant.php, line 38

Class

LayoutBuilderDisplayVariant
Provides a Layout Builder variant.

Namespace

Drupal\page_manager\Plugin\DisplayVariant

Code

public function build() {
  $build = [];
  $contexts = $this
    ->getContexts();
  foreach ($this
    ->getSections() as $delta => $section) {
    $build[$delta] = $section
      ->toRenderArray($contexts);
  }
  return $build;
}