book_node_view(array &$build, EntityInterface $node, EntityViewDisplayInterface$display, $view_mode)
Implements hook_ENTITY_TYPE_view() for node entities.
function book_node_view(array &$build, EntityInterface $node, EntityViewDisplayInterface $display, $view_mode) { if ($view_mode == 'full') { if (!empty($node->book['bid']) && empty($node->in_preview)) { $book_node = Node::load($node->book['bid']); if (!$book_node->access()) { return; } $build['book_navigation'] = array( '#theme' => 'book_navigation', '#book_link' => $node->book, '#weight' => 100, // The book navigation is a listing of Node entities, so associate its // list cache tag for correct invalidation. '#cache' => [ 'tags' => $node->getEntityType()->getListCacheTags(), ], ); } } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!book!book.module/function/book_node_view/8.1.x