MenuTreeStorage::doCollectRoutesAndDefinitions

protected MenuTreeStorage::doCollectRoutesAndDefinitions(array $tree, array &$definitions)

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 988

Class

MenuTreeStorage
Provides a menu tree storage using the database.

Namespace

Drupal\Core\Menu

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
protected function doCollectRoutesAndDefinitions(array $tree, array &$definitions) {
  $route_names = array();
  foreach (array_keys($tree) as $id) {
    $definitions[$id] = $this->definitions[$id];
    if (!empty($definition['route_name'])) {
      $route_names[$definition['route_name']] = $definition['route_name'];
    }
    if ($tree[$id]['subtree']) {
      $route_names += $this->doCollectRoutesAndDefinitions($tree[$id]['subtree'], $definitions);
    }
  }
  return $route_names;
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.