protected function BookManager::loadBooks in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/book/src/BookManager.php \Drupal\book\BookManager::loadBooks()
Loads Books Array.
1 call to BookManager::loadBooks()
- BookManager::getAllBooks in core/
modules/ book/ src/ BookManager.php - Returns an array of all books.
File
- core/
modules/ book/ src/ BookManager.php, line 99 - Contains \Drupal\book\BookManager.
Class
- BookManager
- Defines a book manager.
Namespace
Drupal\bookCode
protected function loadBooks() {
$this->books = array();
$nids = $this->bookOutlineStorage
->getBooks();
if ($nids) {
$book_links = $this->bookOutlineStorage
->loadMultiple($nids);
$nodes = $this->entityManager
->getStorage('node')
->loadMultiple($nids);
// @todo: Sort by weight and translated title.
// @todo: use route name for links, not system path.
foreach ($book_links as $link) {
$nid = $link['nid'];
if (isset($nodes[$nid]) && $nodes[$nid]->status) {
$link['url'] = $nodes[$nid]
->urlInfo();
$link['title'] = $nodes[$nid]
->label();
$link['type'] = $nodes[$nid]
->bundle();
$this->books[$link['bid']] = $link;
}
}
}
}