You are here

public function LayoutBuilderComponentRenderArray::onBuildRender in Layout Builder Component Attributes 1.0.x

Same name and namespace in other branches
  1. 1.2.x src/EventSubscriber/LayoutBuilderComponentRenderArray.php \Drupal\layout_builder_component_attributes\EventSubscriber\LayoutBuilderComponentRenderArray::onBuildRender()
  2. 1.1.x src/EventSubscriber/LayoutBuilderComponentRenderArray.php \Drupal\layout_builder_component_attributes\EventSubscriber\LayoutBuilderComponentRenderArray::onBuildRender()

Adds block classes to section component.

Parameters

\Drupal\layout_builder\Event\SectionComponentBuildRenderArrayEvent $event: The section component render event.

File

src/EventSubscriber/LayoutBuilderComponentRenderArray.php, line 28

Class

LayoutBuilderComponentRenderArray
Class LayoutBuilderComponentRenderArray.

Namespace

Drupal\layout_builder_component_attributes\EventSubscriber

Code

public function onBuildRender(SectionComponentBuildRenderArrayEvent $event) {
  $build = $event
    ->getBuild();
  if (!empty($build)) {
    $build['#component_attributes'] = $event
      ->getComponent()
      ->get('component_attributes');
    $event
      ->setBuild($build);
  }
}