public function MenuTreeStorage::loadSubtreeData in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::loadSubtreeData()
Loads a subtree rooted by the given ID.
The returned links are structured like those from loadTreeData().
Parameters
string $id: The menu link plugin ID.
int $max_relative_depth: (optional) The maximum depth of child menu links relative to the passed in. Defaults to NULL, in which case the full subtree will be returned.
Return value
array An array with 2 elements:
- subtree: A fully built menu tree element or FALSE.
- route_names: An array of all route names used in the subtree.
Overrides MenuTreeStorageInterface::loadSubtreeData
File
- core/
lib/ Drupal/ Core/ Menu/ MenuTreeStorage.php, line 1010 - Contains \Drupal\Core\Menu\MenuTreeStorage.
Class
- MenuTreeStorage
- Provides a menu tree storage using the database.
Namespace
Drupal\Core\MenuCode
public function loadSubtreeData($id, $max_relative_depth = NULL) {
$tree = array();
$root = $this
->loadFull($id);
if (!$root) {
return $tree;
}
$parameters = new MenuTreeParameters();
$parameters
->setRoot($id)
->onlyEnabledLinks();
return $this
->loadTreeData($root['menu_name'], $parameters);
}