protected function MenuRouterRebuildSubscriber::menuLinksRebuild in Zircon Profile 8
Same name and namespace in other branches
- 8.0 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 61 - Contains \Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber.
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__)) {
$transaction = db_transaction();
try {
// Ensure the menu links are up to date.
$this->menuLinkManager
->rebuild();
// Ignore any database replicas temporarily.
db_ignore_replica();
} catch (\Exception $e) {
$transaction
->rollback();
watchdog_exception('menu', $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__);
}
}