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

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
2016-10-29 09:27:36
Comments
Leave a Comment

Please login to continue.