You are here

public function NodeAdminRouteSubscriber::onConfigSave in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/node/src/EventSubscriber/NodeAdminRouteSubscriber.php \Drupal\node\EventSubscriber\NodeAdminRouteSubscriber::onConfigSave()
  2. 10 core/modules/node/src/EventSubscriber/NodeAdminRouteSubscriber.php \Drupal\node\EventSubscriber\NodeAdminRouteSubscriber::onConfigSave()

Rebuilds the router when node.settings:use_admin_theme is changed.

Parameters

\Drupal\Core\Config\ConfigCrudEvent $event:

File

core/modules/node/src/EventSubscriber/NodeAdminRouteSubscriber.php, line 62

Class

NodeAdminRouteSubscriber
Sets the _admin_route for specific node-related routes.

Namespace

Drupal\node\EventSubscriber

Code

public function onConfigSave(ConfigCrudEvent $event) {
  if ($event
    ->getConfig()
    ->getName() === 'node.settings' && $event
    ->isChanged('use_admin_theme')) {
    $this->routerBuilder
      ->setRebuildNeeded();
  }
}