function BookController::bookRender
Same name in other branches
- 9 core/modules/book/src/Controller/BookController.php \Drupal\book\Controller\BookController::bookRender()
- 8.9.x core/modules/book/src/Controller/BookController.php \Drupal\book\Controller\BookController::bookRender()
- 10 core/modules/book/src/Controller/BookController.php \Drupal\book\Controller\BookController::bookRender()
Prints a listing of all books.
Return value
array A render array representing the listing of all books content.
1 string reference to 'BookController::bookRender'
- book.routing.yml in core/
modules/ book/ book.routing.yml - core/modules/book/book.routing.yml
File
-
core/
modules/ book/ src/ Controller/ BookController.php, line 105
Class
- BookController
- Controller routines for book routes.
Namespace
Drupal\book\ControllerCode
public function bookRender() {
$book_list = [];
foreach ($this->bookManager
->getAllBooks() as $book) {
$book_list[] = Link::fromTextAndUrl($book['title'], $book['url']);
}
return [
'#theme' => 'item_list',
'#items' => $book_list,
'#cache' => [
'tags' => $this->entityTypeManager()
->getDefinition('node')
->getListCacheTags(),
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.