function LayoutBuilderConfigSubscriber::onConfigSave

Same name in other branches
  1. 11.x core/modules/layout_builder/src/EventSubscriber/LayoutBuilderConfigSubscriber.php \Drupal\layout_builder\EventSubscriber\LayoutBuilderConfigSubscriber::onConfigSave()

Clears the block plugin cache when expose_all_field_blocks changes.

Parameters

\Drupal\Core\Config\ConfigCrudEvent $event: The configuration event.

File

core/modules/layout_builder/src/EventSubscriber/LayoutBuilderConfigSubscriber.php, line 31

Class

LayoutBuilderConfigSubscriber
Layout Builder Config subscriber.

Namespace

Drupal\layout_builder\EventSubscriber

Code

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();
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.