function BookManager::flatBookTree
Same name in other branches
- 8.9.x core/modules/book/src/BookManager.php \Drupal\book\BookManager::flatBookTree()
- 10 core/modules/book/src/BookManager.php \Drupal\book\BookManager::flatBookTree()
- 11.x core/modules/book/src/BookManager.php \Drupal\book\BookManager::flatBookTree()
Recursively converts a tree of menu links to a flat array.
Parameters
array $tree: A tree of menu links in an array.
array $flat: A flat array of the menu links from $tree, passed by reference.
See also
1 call to BookManager::flatBookTree()
- BookManager::bookTreeGetFlat in core/
modules/ book/ src/ BookManager.php - Gets the book for a page and returns it as a linear array.
File
-
core/
modules/ book/ src/ BookManager.php, line 810
Class
- BookManager
- Defines a book manager.
Namespace
Drupal\bookCode
protected function flatBookTree(array $tree, array &$flat) {
foreach ($tree as $data) {
$flat[$data['link']['nid']] = $data['link'];
if ($data['below']) {
$this->flatBookTree($data['below'], $flat);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.