BookManager::bookTreeGetFlat

public BookManager::bookTreeGetFlat(array $book_link)

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 704

Class

BookManager
Defines a book manager.

Namespace

Drupal\book

Code

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']] = array();
    $this->flatBookTree($tree, $this->bookTreeFlattened[$book_link['nid']]);
  }

  return $this->bookTreeFlattened[$book_link['nid']];
}
doc_Drupal
2016-10-29 08:48:09
Comments
Leave a Comment

Please login to continue.