public function BookController::adminOverview in Zircon Profile 8
Same name and namespace in other branches
- 8.0 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 81 - Contains \Drupal\book\Controller\BookController.
Class
- BookController
- Controller routines for book routes.
Namespace
Drupal\book\ControllerCode
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.'),
);
}