public function LayoutBuilderBrowserEventSubscriber::onView in Gin Layout Builder 1.0.x
Add layout-builder-browser class layout_builder.choose_block build block.
File
- src/
EventSubscriber/ LayoutBuilderBrowserEventSubscriber.php, line 19
Class
- LayoutBuilderBrowserEventSubscriber
- Class LayoutBuilderBrowserEventSubscriber.
Namespace
Drupal\gin_lb\EventSubscriberCode
public function onView(GetResponseForControllerResultEvent $event) {
$request = $event
->getRequest();
$route = $request->attributes
->get('_route');
if ($route == 'layout_builder.choose_block') {
$build = $event
->getControllerResult();
if (is_array($build) && !isset($build['add_block'])) {
$build['block_categories']['#attributes']['class'][] = 'layout-builder-browser';
$event
->setControllerResult($build);
}
}
}