MenuLinkTree::load

public MenuLinkTree::load($menu_name, MenuTreeParameters $parameters)

Loads a menu tree with a menu link plugin instance at each element.

Parameters

string $menu_name: The name of the menu.

\Drupal\Core\Menu\MenuTreeParameters $parameters: The parameters to determine which menu links to be loaded into a tree.

Return value

\Drupal\Core\Menu\MenuLinkTreeElement[] A menu link tree.

Overrides MenuLinkTreeInterface::load

File

core/lib/Drupal/Core/Menu/MenuLinkTree.php, line 88

Class

MenuLinkTree
Implements the loading, transforming and rendering of menu link trees.

Namespace

Drupal\Core\Menu

Code

public function load($menu_name, MenuTreeParameters $parameters) {
  $data = $this->treeStorage->loadTreeData($menu_name, $parameters);
  // Pre-load all the route objects in the tree for access checks.
  if ($data['route_names']) {
    $this->routeProvider->getRoutesByNames($data['route_names']);
  }
  return $this->createInstances($data['tree']);
}
doc_Drupal
2016-10-29 09:27:18
Comments
Leave a Comment

Please login to continue.