public BookController::adminOverview()
Returns an administrative overview of all books.
Return value
array A render array representing the administrative page content.
File
- core/modules/book/src/Controller/BookController.php, line 75
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) {
/** @var \Drupal\Core\Url $url */
$url = $book['url'];
if (isset($book['options'])) {
$url->setOptions($book['options']);
}
$row = array(
$this->l($book['title'], $url),
);
$links = array();
$links['edit'] = array(
'title' => t('Edit order and titles'),
'url' => Url::fromRoute('book.admin_edit', ['node' => $book['nid']]),
);
$row[] = array(
'data' => array(
'#type' => 'operations',
'#links' => $links,
),
);
$rows[] = $row;
}
return array(
'#type' => 'table',
'#header' => $headers,
'#rows' => $rows,
'#empty' => t('No books available.'),
);
}
Please login to continue.