public function UltimenuManager::loadMenuTree in Ultimenu 8
Generate a list of links based on the menu name.
Parameters
string $menu_name: The menu name.
Return value
array An array of the requested menu links.
Overrides UltimenuManagerInterface::loadMenuTree
2 calls to UltimenuManager::loadMenuTree()
- UltimenuManager::buildMenuTree in src/
UltimenuManager.php - Build the menu to contain Ultimenu regions.
- UltimenuManager::getRegions in src/
UltimenuManager.php - The array of available Ultimenu regions based on enabled menu items.
File
- src/
UltimenuManager.php, line 311
Class
- UltimenuManager
- Manages Ultimenu plugin.
Namespace
Drupal\ultimenuCode
public function loadMenuTree($menu_name) {
$menu_tree = $this->menuTree;
$parameters = new MenuTreeParameters();
$parameters
->setTopLevelOnly()
->onlyEnabledLinks();
$tree = $menu_tree
->load($menu_name, $parameters);
$manipulators = [
[
'callable' => 'menu.default_tree_manipulators:checkAccess',
],
[
'callable' => 'menu.default_tree_manipulators:generateIndexAndSort',
],
[
'callable' => 'menu.default_tree_manipulators:flatten',
],
];
$tree = $menu_tree
->transform($tree, $manipulators);
return $tree;
}