Same name and namespace in other branches
  1. 8.9.x core/modules/book/src/BookManager.php \Drupal\book\BookManager::bookTreeBuild()
  2. 9 core/modules/book/src/BookManager.php \Drupal\book\BookManager::bookTreeBuild()

Builds a book tree, translates links, and checks access.

Parameters

int $bid: The Book ID to find links for.

array $parameters: (optional) An associative array of build parameters. Possible keys:

  • expanded: An array of parent link IDs to return only book links that are children of one of the parent link IDs in this list. If empty, the whole outline is built, unless 'only_active_trail' is TRUE.
  • active_trail: An array of node IDs, representing the currently active book link.
  • only_active_trail: Whether to only return links that are in the active trail. This option is ignored if 'expanded' is non-empty.
  • min_depth: The minimum depth of book links in the resulting tree. Defaults to 1, which is to build the whole tree for the book.
  • max_depth: The maximum depth of book links in the resulting tree.
  • conditions: An associative array of custom database select query condition key/value pairs; see \Drupal\book\BookOutlineStorage::getBookMenuTree() for the actual query.

Return value

array A fully built book tree.

1 call to BookManager::bookTreeBuild()
BookManager::bookTreeAllData in core/modules/book/src/BookManager.php

File

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

Class

BookManager
Defines a book manager.

Namespace

Drupal\book

Code

protected function bookTreeBuild($bid, array $parameters = []) {

  // Build the book tree.
  $data = $this
    ->doBookTreeBuild($bid, $parameters);

  // Check access for the current user to each item in the tree.
  $this
    ->bookTreeCheckAccess($data['tree'], $data['node_links']);
  return $data['tree'];
}