BookManagerInterface
interface BookManagerInterface (View source)
Provides an interface defining a book manager.
Methods
Gets the data structure representing a named menu tree.
Gets the active trail IDs for the specified book at the provided path.
Loads a single book entry.
Loads multiple book entries.
Returns an array of book pages in table of contents order.
Finds the depth limit for items in the parent select.
Collects node links from a given menu tree recursively.
Provides book loading, access control and translation.
Gets the book for a page and returns it as a linear array.
Returns an array of all books.
Saves a single book entry.
Returns an array with default values for a book page's menu link.
No description
Builds the common elements of the book form for the node and outline forms.
Deletes node's entry from book table.
Returns a rendered menu tree.
Checks access and performs dynamic operations for each link in the tree.
Gets the data representing a subtree of the book hierarchy.
Details
array
bookTreeAllData(int $bid, array|null $link = NULL, int|null $max_depth = NULL)
Gets the data structure representing a named menu tree.
Since this can be the full tree including hidden items, the data returned may be used for generating an admin interface or a select.
Note: based on menu_tree_all_data().
array
getActiveTrailIds(string $bid, array $link)
Gets the active trail IDs for the specified book at the provided path.
array
loadBookLink(int $nid, bool $translate = TRUE)
Loads a single book entry.
The entries of a book entry is documented in \Drupal\book\BookOutlineStorageInterface::loadMultiple.
If $translate is TRUE, it also checks access ('access' key) and loads the title from the node itself.
array[]
loadBookLinks(int[] $nids, bool $translate = TRUE)
Loads multiple book entries.
The entries of a book entry is documented in \Drupal\book\BookOutlineStorageInterface::loadMultiple.
If $translate is TRUE, it also checks access ('access' key) and loads the title from the node itself.
array
getTableOfContents(int $bid, int $depth_limit, array $exclude = [])
Returns an array of book pages in table of contents order.
int
getParentDepthLimit(array $book_link)
Finds the depth limit for items in the parent select.
bookTreeCollectNodeLinks(array $tree, array $node_links)
Collects node links from a given menu tree recursively.
bookLinkTranslate(array $link)
Provides book loading, access control and translation.
Note: copied from _menu_link_translate() in menu.inc, but reduced to the minimal code that's used.
array
bookTreeGetFlat(array $book_link)
Gets the book for a page and returns it as a linear array.
array
getAllBooks()
Returns an array of all books.
This list may be used for generating a list of all the books, or for building the options for a form select.
bool
updateOutline(NodeInterface $node)
Handles additions and updates to the book outline.
This common helper function performs all additions and updates to the book outline through node addition, node editing, node deletion, or the outline tab.
array
saveBookLink(array $link, bool $new)
Saves a single book entry.
array
getLinkDefaults(string|int $nid)
Returns an array with default values for a book page's menu link.
getBookParents(array $item, array $parent = [])
No description
array
addFormElements(array $form, FormStateInterface $form_state, NodeInterface $node, AccountInterface $account, bool $collapsed = TRUE)
Builds the common elements of the book form for the node and outline forms.
deleteFromBook(int $nid)
Deletes node's entry from book table.
array
bookTreeOutput(array $tree)
Returns a rendered menu tree.
The menu item's LI element is given one of the following classes:
- expanded: The menu item is showing its submenu.
- collapsed: The menu item has a submenu which is not shown.
bookTreeCheckAccess(array $tree, array $node_links = [])
Checks access and performs dynamic operations for each link in the tree.
A
bookSubtreeData(array $link)
Gets the data representing a subtree of the book hierarchy.
The root of the subtree will be the link passed as a parameter, so the returned tree will contain this item and all its descendants in the menu tree.
bool
checkNodeIsRemovable(NodeInterface $node)
Determines if a node can be removed from the book.
A node can be removed from a book if it is actually in a book and it either is not a top-level page or is a top-level page with no children.