function MenuTreeStorage::loadTreeData
Same name in other branches
- 9 core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::loadTreeData()
- 8.9.x core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::loadTreeData()
- 11.x core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::loadTreeData()
2 calls to MenuTreeStorage::loadTreeData()
- MenuTreeStorage::loadSubtreeData in core/
lib/ Drupal/ Core/ Menu/ MenuTreeStorage.php - WorkspacesMenuTreeStorage::loadTreeData in core/
modules/ workspaces/ src/ WorkspacesMenuTreeStorage.php
1 method overrides MenuTreeStorage::loadTreeData()
- WorkspacesMenuTreeStorage::loadTreeData in core/
modules/ workspaces/ src/ WorkspacesMenuTreeStorage.php
File
-
core/
lib/ Drupal/ Core/ Menu/ MenuTreeStorage.php, line 826
Class
- MenuTreeStorage
- Provides a menu tree storage using the database.
Namespace
Drupal\Core\MenuCode
public function loadTreeData($menu_name, MenuTreeParameters $parameters) {
$tree_cid = "tree-data:{$menu_name}:" . serialize($parameters);
$cache = $this->menuCacheBackend
->get($tree_cid);
if ($cache && isset($cache->data)) {
$data = $cache->data;
// Cache the definitions in memory so they don't need to be loaded again.
$this->definitions += $data['definitions'];
unset($data['definitions']);
}
else {
$links = $this->loadLinks($menu_name, $parameters);
$data['tree'] = $this->doBuildTreeData($links, $parameters->activeTrail, $parameters->minDepth);
$data['definitions'] = [];
$data['route_names'] = $this->collectRoutesAndDefinitions($data['tree'], $data['definitions']);
$this->menuCacheBackend
->set($tree_cid, $data, Cache::PERMANENT, [
'config:system.menu.' . $menu_name,
]);
// The definitions were already added to $this->definitions in
// $this->doBuildTreeData()
unset($data['definitions']);
}
return $data;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.