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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 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.