class LayoutBuilderConfigSubscriber
Same name in other branches
- 11.x core/modules/layout_builder/src/EventSubscriber/LayoutBuilderConfigSubscriber.php \Drupal\layout_builder\EventSubscriber\LayoutBuilderConfigSubscriber
Layout Builder Config subscriber.
Hierarchy
- class \Drupal\layout_builder\EventSubscriber\LayoutBuilderConfigSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of LayoutBuilderConfigSubscriber
File
-
core/
modules/ layout_builder/ src/ EventSubscriber/ LayoutBuilderConfigSubscriber.php, line 15
Namespace
Drupal\layout_builder\EventSubscriberView source
final class LayoutBuilderConfigSubscriber implements EventSubscriberInterface {
/**
* Constructs a LayoutBuilderConfigSubscriber.
*/
public function __construct(BlockManagerInterface $blockManager) {
}
/**
* Clears the block plugin cache when expose_all_field_blocks changes.
*
* @param \Drupal\Core\Config\ConfigCrudEvent $event
* The configuration event.
*/
public function onConfigSave(ConfigCrudEvent $event) : void {
$saved_config = $event->getConfig();
if ($saved_config->getName() == 'layout_builder.settings' && $event->isChanged('expose_all_field_blocks')) {
$this->blockManager
->clearCachedDefinitions();
}
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() : array {
$events[ConfigEvents::SAVE][] = [
'onConfigSave',
];
return $events;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
LayoutBuilderConfigSubscriber::getSubscribedEvents | public static | function | |
LayoutBuilderConfigSubscriber::onConfigSave | public | function | Clears the block plugin cache when expose_all_field_blocks changes. |
LayoutBuilderConfigSubscriber::__construct | public | function | Constructs a LayoutBuilderConfigSubscriber. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.