interface BookOutlineStorageInterface (View source)

Defines a common interface for book outline storage classes.

Methods

array
getBooks()

Gets books (the highest positioned book links).

bool
hasBooks()

Checks if there are any books.

array
loadMultiple(array $nids, bool $access = TRUE)

Loads books.

int
getChildRelativeDepth(array $book_link, int $max_depth)

Gets child relative depth.

mixed
delete(int $nid)

Deletes a book entry.

array
loadBookChildren(int $pid)

Loads book's children using its parent ID.

array
getBookMenuTree(int $bid, array $parameters, int $min_depth, int $max_depth)

Builds tree data used for the menu tree.

mixed
insert(array $link, array $parents)

Inserts a book link.

mixed
update(int $nid, array $fields)

Updates book reference for links that were moved between books.

mixed
updateMovedChildren(int $bid, array $original, array $expressions, int $shift)

Update the book ID of the book link that it's being moved.

int
countOriginalLinkChildren(array $original)

Count the number of original link children.

array
getBookSubtree(array $link, int $max_depth)

Get book subtree.

Details

array getBooks()

Gets books (the highest positioned book links).

Return Value

array

An array of book IDs.

bool hasBooks()

Checks if there are any books.

Return Value

bool

TRUE if there are books, FALSE if not.

array loadMultiple(array $nids, bool $access = TRUE)

Loads books.

Each book entry consists of the following keys:

  • bid: The node ID of the main book.
  • nid: The node ID of the book entry itself.
  • pid: The parent node ID of the book.
  • has_children: A boolean to indicate whether the book has children.
  • weight: The weight of the book entry to order siblings.
  • depth: The depth in the menu hierarchy the entry is placed into.

Parameters

array $nids

An array of node IDs.

bool $access

Whether access checking should be taken into account.

Return Value

array

Array of loaded book items.

int getChildRelativeDepth(array $book_link, int $max_depth)

Gets child relative depth.

Parameters

array $book_link

The book link.

int $max_depth

The maximum supported depth of the book tree.

Return Value

int

The depth of the searched book.

mixed delete(int $nid)

Deletes a book entry.

Parameters

int $nid

Deletes a book entry.

Return Value

mixed

Number of deleted book entries.

array loadBookChildren(int $pid)

Loads book's children using its parent ID.

Parameters

int $pid

The book's parent ID.

Return Value

array

Array of loaded book items.

array getBookMenuTree(int $bid, array $parameters, int $min_depth, int $max_depth)

Builds tree data used for the menu tree.

Parameters

int $bid

The ID of the book that we are building the tree for.

array $parameters

An associative array of build parameters. For info about individual parameters see BookManager::bookTreeBuild().

int $min_depth

The minimum depth of book links in the resulting tree.

int $max_depth

The maximum supported depth of the book tree.

Return Value

array

Array of loaded book links.

mixed insert(array $link, array $parents)

Inserts a book link.

Parameters

array $link

The link array to be inserted in the database.

array $parents

The array of parent ids for the link to be inserted.

Return Value

mixed

The last insert ID of the query, if one exists.

mixed update(int $nid, array $fields)

Updates book reference for links that were moved between books.

Parameters

int $nid

The nid of the book entry to be updated.

array $fields

The array of fields to be updated.

Return Value

mixed

The number of rows matched by the update query.

mixed updateMovedChildren(int $bid, array $original, array $expressions, int $shift)

Update the book ID of the book link that it's being moved.

Parameters

int $bid

The ID of the book whose children we move.

array $original

The original parent of the book link.

array $expressions

Array of expressions to be added to the query.

int $shift

The difference in depth between the old and the new position of the element being moved.

Return Value

mixed

The number of rows matched by the update query.

int countOriginalLinkChildren(array $original)

Count the number of original link children.

Parameters

array $original

The book link array.

Return Value

int

Number of children.

array getBookSubtree(array $link, int $max_depth)

Get book subtree.

Parameters

array $link

A fully loaded book link.

int $max_depth

The maximum supported depth of the book tree.

Return Value

array

Array of unordered subtree book items.