You are here

public function BookOutlineStorage::loadMultiple in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/book/src/BookOutlineStorage.php \Drupal\book\BookOutlineStorage::loadMultiple()

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.

Overrides BookOutlineStorageInterface::loadMultiple

File

core/modules/book/src/BookOutlineStorage.php, line 50
Contains \Drupal\book\BookOutlineStorage.

Class

BookOutlineStorage
Defines a storage class for books outline.

Namespace

Drupal\book

Code

public function loadMultiple($nids, $access = TRUE) {
  $query = $this->connection
    ->select('book', 'b', array(
    'fetch' => \PDO::FETCH_ASSOC,
  ));
  $query
    ->fields('b');
  $query
    ->condition('b.nid', $nids, 'IN');
  if ($access) {
    $query
      ->addTag('node_access');
    $query
      ->addMetaData('base_table', 'book');
  }
  return $query
    ->execute();
}