You are here

public function MenuLinkManager::rebuild in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Menu/MenuLinkManager.php \Drupal\Core\Menu\MenuLinkManager::rebuild()

Triggers discovery, save, and cleanup of discovered links.

Overrides MenuLinkManagerInterface::rebuild

File

core/lib/Drupal/Core/Menu/MenuLinkManager.php, line 188

Class

MenuLinkManager
Manages discovery, instantiation, and tree building of menu link plugins.

Namespace

Drupal\Core\Menu

Code

public function rebuild() {
  $definitions = $this
    ->getDefinitions();

  // Apply overrides from config.
  $overrides = $this->overrides
    ->loadMultipleOverrides(array_keys($definitions));
  foreach ($overrides as $id => $changes) {
    if (!empty($definitions[$id])) {
      $definitions[$id] = $changes + $definitions[$id];
    }
  }
  $this->treeStorage
    ->rebuild($definitions);
}