You are here

public function BookController::bookRender in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 122
Contains \Drupal\book\Controller\BookController.

Class

BookController
Controller routines for book routes.

Namespace

Drupal\book\Controller

Code

public function bookRender() {
  $book_list = array();
  foreach ($this->bookManager
    ->getAllBooks() as $book) {
    $book_list[] = $this
      ->l($book['title'], $book['url']);
  }
  return array(
    '#theme' => 'item_list',
    '#items' => $book_list,
    '#cache' => [
      'tags' => \Drupal::entityManager()
        ->getDefinition('node')
        ->getListCacheTags(),
    ],
  );
}