You are here

public function BookManager::getTableOfContents in Drupal 8

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

Returns an array of book pages in table of contents order.

Parameters

int $bid: The ID of the book whose pages are to be listed.

int $depth_limit: Any link deeper than this value will be excluded (along with its children).

array $exclude: (optional) An array of menu link ID values. Any link whose menu link ID is in this array will be excluded (along with its children). Defaults to an empty array.

Return value

array An array of (menu link ID, title) pairs for use as options for selecting a book page.

Overrides BookManagerInterface::getTableOfContents

1 call to BookManager::getTableOfContents()
BookManager::addParentSelectFormElements in core/modules/book/src/BookManager.php
Builds the parent selection form element for the node form or outline tab.

File

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

Class

BookManager
Defines a book manager.

Namespace

Drupal\book

Code

public function getTableOfContents($bid, $depth_limit, array $exclude = []) {
  $tree = $this
    ->bookTreeAllData($bid);
  $toc = [];
  $this
    ->recurseTableOfContents($tree, '', $toc, $exclude, $depth_limit);
  return $toc;
}