public function BookController::adminOverview

Returns an administrative overview of all books.

Return value

string A HTML-formatted string with the administrative page content.

1 string reference to 'BookController::adminOverview'
book.routing.yml in drupal/core/modules/book/book.routing.yml
drupal/core/modules/book/book.routing.yml

File

drupal/core/modules/book/lib/Drupal/book/Controller/BookController.php, line 47
Contains \Drupal\book\Controller\BookController.

Class

BookController
Controller routines for book routes.

Namespace

Drupal\book\Controller

Code

public function adminOverview() {
  $rows = array();
  $headers = array(
    t('Book'),
    t('Operations'),
  );

  // Add any recognized books to the table list.
  foreach ($this->bookManager
    ->getAllBooks() as $book) {
    $row = array(
      l($book['title'], $book['href'], $book['options']),
    );
    $links = array();
    $links['edit'] = array(
      'title' => t('Edit order and titles'),
      'href' => 'admin/structure/book/' . $book['nid'],
    );
    $row[] = array(
      'data' => array(
        '#type' => 'operations',
        '#links' => $links,
      ),
    );
    $rows[] = $row;
  }
  $table = array(
    '#theme' => 'table',
    '#header' => $headers,
    '#rows' => $rows,
    '#empty' => t('No books available.'),
  );
  return drupal_render($table);
}