class LayoutBuilderComponentRenderArray in Layout Builder Component Attributes 1.1.x
Same name and namespace in other branches
- 1.2.x src/EventSubscriber/LayoutBuilderComponentRenderArray.php \Drupal\layout_builder_component_attributes\EventSubscriber\LayoutBuilderComponentRenderArray
- 1.0.x src/EventSubscriber/LayoutBuilderComponentRenderArray.php \Drupal\layout_builder_component_attributes\EventSubscriber\LayoutBuilderComponentRenderArray
Class LayoutBuilderComponentRenderArray.
Hierarchy
- class \Drupal\layout_builder_component_attributes\EventSubscriber\LayoutBuilderComponentRenderArray implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of LayoutBuilderComponentRenderArray
1 string reference to 'LayoutBuilderComponentRenderArray'
1 service uses LayoutBuilderComponentRenderArray
File
- src/
EventSubscriber/ LayoutBuilderComponentRenderArray.php, line 12
Namespace
Drupal\layout_builder_component_attributes\EventSubscriberView source
class LayoutBuilderComponentRenderArray implements EventSubscriberInterface {
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events[LayoutBuilderEvents::SECTION_COMPONENT_BUILD_RENDER_ARRAY] = [
'onBuildRender',
];
return $events;
}
/**
* Adds block classes to section component.
*
* @param \Drupal\layout_builder\Event\SectionComponentBuildRenderArrayEvent $event
* The section component render event.
*/
public function onBuildRender(SectionComponentBuildRenderArrayEvent $event) {
$build = $event
->getBuild();
if (!empty($build)) {
$build['#component_attributes'] = $event
->getComponent()
->get('component_attributes');
$event
->setBuild($build);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LayoutBuilderComponentRenderArray:: |
public static | function | ||
LayoutBuilderComponentRenderArray:: |
public | function | Adds block classes to section component. |