book_node_view(array &$build, EntityInterface $node, EntityViewDisplayInterface $display, $view_mode)
Implements hook_ENTITY_TYPE_view() for node entities.
File
- core/modules/book/book.module, line 228
- Allows users to create and organize related content in an outline.
Code
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(), ], ); } } }
Please login to continue.