function BookManager::bookTreeAllData
Same name in other branches
- 9 core/modules/book/src/BookManager.php \Drupal\book\BookManager::bookTreeAllData()
- 10 core/modules/book/src/ProxyClass/BookManager.php \Drupal\book\ProxyClass\BookManager::bookTreeAllData()
- 10 core/modules/book/src/BookManager.php \Drupal\book\BookManager::bookTreeAllData()
- 11.x core/modules/book/src/ProxyClass/BookManager.php \Drupal\book\ProxyClass\BookManager::bookTreeAllData()
- 11.x core/modules/book/src/BookManager.php \Drupal\book\BookManager::bookTreeAllData()
Overrides BookManagerInterface::bookTreeAllData
2 calls to BookManager::bookTreeAllData()
- BookManager::bookTreeGetFlat in core/
modules/ book/ src/ BookManager.php - Gets the book for a page and returns it as a linear array.
- BookManager::getTableOfContents in core/
modules/ book/ src/ BookManager.php - Returns an array of book pages in table of contents order.
File
-
core/
modules/ book/ src/ BookManager.php, line 484
Class
- BookManager
- Defines a book manager.
Namespace
Drupal\bookCode
public function bookTreeAllData($bid, $link = NULL, $max_depth = NULL) {
$tree =& drupal_static(__METHOD__, []);
$language_interface = \Drupal::languageManager()->getCurrentLanguage();
// Use $nid as a flag for whether the data being loaded is for the whole
// tree.
$nid = isset($link['nid']) ? $link['nid'] : 0;
// Generate a cache ID (cid) specific for this $bid, $link, $language, and
// depth.
$cid = 'book-links:' . $bid . ':all:' . $nid . ':' . $language_interface->getId() . ':' . (int) $max_depth;
if (!isset($tree[$cid])) {
// If the tree data was not in the static cache, build $tree_parameters.
$tree_parameters = [
'min_depth' => 1,
'max_depth' => $max_depth,
];
if ($nid) {
$active_trail = $this->getActiveTrailIds($bid, $link);
$tree_parameters['expanded'] = $active_trail;
$tree_parameters['active_trail'] = $active_trail;
$tree_parameters['active_trail'][] = $nid;
}
// Build the tree using the parameters; the resulting tree will be cached.
$tree[$cid] = $this->bookTreeBuild($bid, $tree_parameters);
}
return $tree[$cid];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.