public function LayoutBuilderTestPlugin::build in Drupal 10
Same name and namespace in other branches
- 8 core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Layout/LayoutBuilderTestPlugin.php \Drupal\layout_builder_test\Plugin\Layout\LayoutBuilderTestPlugin::build()
- 9 core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Layout/LayoutBuilderTestPlugin.php \Drupal\layout_builder_test\Plugin\Layout\LayoutBuilderTestPlugin::build()
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 LayoutDefault::build
File
- core/
modules/ layout_builder/ tests/ modules/ layout_builder_test/ src/ Plugin/ Layout/ LayoutBuilderTestPlugin.php, line 23
Class
- LayoutBuilderTestPlugin
- Plugin annotation @Layout( id = "layout_builder_test_plugin", label = @Translation("Layout Builder Test Plugin"), regions = { "main" = { "label" = @Translation("Main Region") } }, )
Namespace
Drupal\layout_builder_test\Plugin\LayoutCode
public function build(array $regions) {
$build = parent::build($regions);
$build['main']['#attributes']['class'][] = 'go-birds';
if ($this->inPreview) {
$build['main']['#attributes']['class'][] = 'go-birds-preview';
}
return $build;
}