function BookManager::bookTreeCollectNodeLinks

Same name in this branch
  1. 10 core/modules/book/src/ProxyClass/BookManager.php \Drupal\book\ProxyClass\BookManager::bookTreeCollectNodeLinks()
Same name and namespace in other branches
  1. 9 core/modules/book/src/BookManager.php \Drupal\book\BookManager::bookTreeCollectNodeLinks()
  2. 8.9.x core/modules/book/src/BookManager.php \Drupal\book\BookManager::bookTreeCollectNodeLinks()
  3. 11.x core/modules/book/src/ProxyClass/BookManager.php \Drupal\book\ProxyClass\BookManager::bookTreeCollectNodeLinks()
  4. 11.x core/modules/book/src/BookManager.php \Drupal\book\BookManager::bookTreeCollectNodeLinks()

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

2 calls to BookManager::bookTreeCollectNodeLinks()
BookManager::bookSubtreeData in core/modules/book/src/BookManager.php
Gets the data representing a subtree of the book hierarchy.
BookManager::doBookTreeBuild in core/modules/book/src/BookManager.php
Builds a book tree.

File

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

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);
    }
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.