function TestContextAwareLayout::build

Same name in other branches
  1. 9 core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Layout/TestContextAwareLayout.php \Drupal\layout_builder_test\Plugin\Layout\TestContextAwareLayout::build()
  2. 11.x core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Layout/TestContextAwareLayout.php \Drupal\layout_builder_test\Plugin\Layout\TestContextAwareLayout::build()

Overrides LayoutDefault::build

File

core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Layout/TestContextAwareLayout.php, line 30

Class

TestContextAwareLayout
The TestContextAwareLayout Class.

Namespace

Drupal\layout_builder_test\Plugin\Layout

Code

public function build(array $regions) {
    $build = parent::build($regions);
    $build['main']['#attributes']['class'][] = 'user--' . $this->getContextValue('user')
        ->getAccountName();
    return $build;
}

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