function MenuRouterRebuildSubscriber::onRouterRebuild

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php \Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber::onRouterRebuild()
  2. 10 core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php \Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber::onRouterRebuild()
  3. 11.x core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php \Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber::onRouterRebuild()

Rebuilds the menu links and deletes the local_task cache tag.

Parameters

\Drupal\Component\EventDispatcher\Event $event: The event object.

File

core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php, line 69

Class

MenuRouterRebuildSubscriber
Rebuilds the default menu links and runs menu-specific code if necessary.

Namespace

Drupal\Core\EventSubscriber

Code

public function onRouterRebuild($event) {
    $this->menuLinksRebuild();
    Cache::invalidateTags([
        'local_task',
    ]);
}

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