You are here

public function BookManager::loadBookLinks in Drupal 8

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

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.

Parameters

int[] $nids: An array of nids to load.

bool $translate: If TRUE, set access, title, and other elements.

Return value

array[] The book data of each node keyed by NID.

Overrides BookManagerInterface::loadBookLinks

See also

\Drupal\book\BookOutlineStorageInterface::loadMultiple

1 call to BookManager::loadBookLinks()
BookManager::loadBookLink in core/modules/book/src/BookManager.php
Loads a single book entry.

File

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

Class

BookManager
Defines a book manager.

Namespace

Drupal\book

Code

public function loadBookLinks($nids, $translate = TRUE) {
  $result = $this->bookOutlineStorage
    ->loadMultiple($nids, $translate);
  $links = [];
  foreach ($result as $link) {
    if ($translate) {
      $this
        ->bookLinkTranslate($link);
    }
    $links[$link['nid']] = $link;
  }
  return $links;
}