function MenuRouterRebuildSubscriber::menuLinksRebuild
Same name in other branches
- 9 core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php \Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber::menuLinksRebuild()
- 8.9.x core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php \Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber::menuLinksRebuild()
- 11.x core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php \Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber::menuLinksRebuild()
Perform menu-specific rebuilding.
1 call to MenuRouterRebuildSubscriber::menuLinksRebuild()
- MenuRouterRebuildSubscriber::onRouterRebuild in core/
lib/ Drupal/ Core/ EventSubscriber/ MenuRouterRebuildSubscriber.php - Rebuilds the menu links and deletes the local_task cache tag.
File
-
core/
lib/ Drupal/ Core/ EventSubscriber/ MenuRouterRebuildSubscriber.php, line 85
Class
- MenuRouterRebuildSubscriber
- Rebuilds the default menu links and runs menu-specific code if necessary.
Namespace
Drupal\Core\EventSubscriberCode
protected function menuLinksRebuild() {
if ($this->lock
->acquire(__FUNCTION__)) {
try {
$transaction = $this->connection
->startTransaction();
// Ensure the menu links are up to date.
$this->menuLinkManager
->rebuild();
// Ignore any database replicas temporarily.
$this->replicaKillSwitch
->trigger();
} catch (\Exception $e) {
if (isset($transaction)) {
$transaction->rollBack();
}
Error::logException($this->logger, $e);
}
$this->lock
->release(__FUNCTION__);
}
else {
// Wait for another request that is already doing this work.
// We choose to block here since otherwise the router item may not
// be available during routing resulting in a 404.
$this->lock
->wait(__FUNCTION__);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.