public function BookManager::bookTreeGetFlat in Drupal 8
Same name and namespace in other branches
- 9 core/modules/book/src/BookManager.php \Drupal\book\BookManager::bookTreeGetFlat()
Gets the book for a page and returns it as a linear array.
Parameters
array $book_link: A fully loaded book link that is part of the book hierarchy.
Return value
array A linear array of book links in the order that the links are shown in the book, so the previous and next pages are the elements before and after the element corresponding to the current node. The children of the current node (if any) will come immediately after it in the array, and links will only be fetched as deep as one level deeper than $book_link.
Overrides BookManagerInterface::bookTreeGetFlat
File
- core/
modules/ book/ src/ BookManager.php, line 735
Class
- BookManager
- Defines a book manager.
Namespace
Drupal\bookCode
public function bookTreeGetFlat(array $book_link) {
if (!isset($this->bookTreeFlattened[$book_link['nid']])) {
// Call $this->bookTreeAllData() to take advantage of caching.
$tree = $this
->bookTreeAllData($book_link['bid'], $book_link, $book_link['depth'] + 1);
$this->bookTreeFlattened[$book_link['nid']] = [];
$this
->flatBookTree($tree, $this->bookTreeFlattened[$book_link['nid']]);
}
return $this->bookTreeFlattened[$book_link['nid']];
}