function SystemConfigSubscriber::onConfigSave

Same name and namespace in other branches
  1. 9 core/modules/system/src/SystemConfigSubscriber.php \Drupal\system\SystemConfigSubscriber::onConfigSave()
  2. 10 core/modules/system/src/SystemConfigSubscriber.php \Drupal\system\SystemConfigSubscriber::onConfigSave()
  3. 11.x core/modules/system/src/SystemConfigSubscriber.php \Drupal\system\SystemConfigSubscriber::onConfigSave()

Rebuilds the router when the default or admin theme is changed.

Parameters

\Drupal\Core\Config\ConfigCrudEvent $event:

File

core/modules/system/src/SystemConfigSubscriber.php, line 40

Class

SystemConfigSubscriber
System Config subscriber.

Namespace

Drupal\system

Code

public function onConfigSave(ConfigCrudEvent $event) {
    $saved_config = $event->getConfig();
    if ($saved_config->getName() == 'system.theme' && ($event->isChanged('admin') || $event->isChanged('default'))) {
        $this->routerBuilder
            ->setRebuildNeeded();
    }
}

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