BookManager::bookTreeCollectNodeLinks

public BookManager::bookTreeCollectNodeLinks(&$tree, &$node_links)

Collects node links from a given menu tree recursively.

Parameters

array $tree: The menu tree you wish to collect node links from.

array $node_links: An array in which to store the collected node links.

Overrides BookManagerInterface::bookTreeCollectNodeLinks

File

core/modules/book/src/BookManager.php, line 688

Class

BookManager
Defines a book manager.

Namespace

Drupal\book

Code

public function bookTreeCollectNodeLinks(&$tree, &$node_links) {
  // All book links are nodes.
  // @todo clean this up.
  foreach ($tree as $key => $v) {
    $nid = $v['link']['nid'];
    $node_links[$nid][$tree[$key]['link']['nid']] = &$tree[$key]['link'];
    $tree[$key]['link']['access'] = FALSE;
    if ($tree[$key]['below']) {
      $this->bookTreeCollectNodeLinks($tree[$key]['below'], $node_links);
    }
  }
}
doc_Drupal
2016-10-29 08:48:08
Comments
Leave a Comment

Please login to continue.