function BookController::adminOverview
Same name in other branches
- 9 core/modules/book/src/Controller/BookController.php \Drupal\book\Controller\BookController::adminOverview()
- 8.9.x core/modules/book/src/Controller/BookController.php \Drupal\book\Controller\BookController::adminOverview()
- 11.x core/modules/book/src/Controller/BookController.php \Drupal\book\Controller\BookController::adminOverview()
Returns an administrative overview of all books.
Return value
array A render array representing the administrative page content.
1 string reference to 'BookController::adminOverview'
- 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 64
Class
- BookController
- Controller routines for book routes.
Namespace
Drupal\book\ControllerCode
public function adminOverview() {
$rows = [];
$headers = [
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 = [
Link::fromTextAndUrl($book['title'], $url),
];
$links = [];
$links['edit'] = [
'title' => t('Edit order and titles'),
'url' => Url::fromRoute('book.admin_edit', [
'node' => $book['nid'],
]),
];
$row[] = [
'data' => [
'#type' => 'operations',
'#links' => $links,
],
];
$rows[] = $row;
}
return [
'#type' => 'table',
'#header' => $headers,
'#rows' => $rows,
'#empty' => t('No books available.'),
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.