protected function MenuTreeStorage::doCollectRoutesAndDefinitions in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::doCollectRoutesAndDefinitions()
- 9 core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::doCollectRoutesAndDefinitions()
Collects all the route names and definitions.
Parameters
array $tree: A menu link tree from MenuTreeStorage::doBuildTreeData()
array $definitions: The collected definitions which are populated by reference.
Return value
array The collected route names.
File
- core/
lib/ Drupal/ Core/ Menu/ MenuTreeStorage.php, line 1003
Class
- MenuTreeStorage
- Provides a menu tree storage using the database.
Namespace
Drupal\Core\MenuCode
protected function doCollectRoutesAndDefinitions(array $tree, array &$definitions) {
$route_names = [];
foreach (array_keys($tree) as $id) {
$definitions[$id] = $this->definitions[$id];
if (!empty($definitions[$id]['route_name'])) {
$route_names[$definitions[$id]['route_name']] = $definitions[$id]['route_name'];
}
if ($tree[$id]['subtree']) {
$route_names += $this
->doCollectRoutesAndDefinitions($tree[$id]['subtree'], $definitions);
}
}
return $route_names;
}