public function MenuLinkTree::load in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Menu/MenuLinkTree.php \Drupal\Core\Menu\MenuLinkTree::load()
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 96
Class
- MenuLinkTree
- Implements the loading, transforming and rendering of menu link trees.
Namespace
Drupal\Core\MenuCode
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 instanceof PreloadableRouteProviderInterface) {
$this->routeProvider
->getRoutesByNames($data['route_names']);
}
return $this
->createInstances($data['tree']);
}