book-navigation.html.twig

Same filename in this branch
  1. 9 core/profiles/demo_umami/themes/umami/templates/classy/navigation/book-navigation.html.twig
  2. 9 core/themes/stable9/templates/navigation/book-navigation.html.twig
  3. 9 core/themes/seven/templates/classy/navigation/book-navigation.html.twig
  4. 9 core/themes/claro/templates/classy/navigation/book-navigation.html.twig
  5. 9 core/themes/bartik/templates/classy/navigation/book-navigation.html.twig
  6. 9 core/themes/stable/templates/navigation/book-navigation.html.twig
  7. 9 core/themes/classy/templates/navigation/book-navigation.html.twig
  8. 9 core/modules/book/templates/book-navigation.html.twig
Same filename in other branches
  1. 8.9.x core/profiles/demo_umami/themes/umami/templates/classy/navigation/book-navigation.html.twig
  2. 8.9.x core/themes/seven/templates/classy/navigation/book-navigation.html.twig
  3. 8.9.x core/themes/claro/templates/classy/navigation/book-navigation.html.twig
  4. 8.9.x core/themes/bartik/templates/classy/navigation/book-navigation.html.twig
  5. 8.9.x core/themes/stable/templates/navigation/book-navigation.html.twig
  6. 8.9.x core/themes/classy/templates/navigation/book-navigation.html.twig
  7. 8.9.x core/modules/book/templates/book-navigation.html.twig
  8. 10 core/profiles/demo_umami/themes/umami/templates/classy/navigation/book-navigation.html.twig
  9. 10 core/themes/olivero/templates/navigation/book-navigation.html.twig
  10. 10 core/themes/stable9/templates/navigation/book-navigation.html.twig
  11. 10 core/themes/claro/templates/classy/navigation/book-navigation.html.twig
  12. 10 core/modules/book/templates/book-navigation.html.twig
  13. 11.x core/profiles/demo_umami/themes/umami/templates/classy/navigation/book-navigation.html.twig
  14. 11.x core/themes/olivero/templates/navigation/book-navigation.html.twig
  15. 11.x core/themes/stable9/templates/navigation/book-navigation.html.twig
  16. 11.x core/themes/claro/templates/classy/navigation/book-navigation.html.twig
  17. 11.x core/modules/book/templates/book-navigation.html.twig

Theme override to navigate books.

Presented under nodes that are a part of book outlines.

Available variables:

  • tree: The immediate children of the current node rendered as an unordered list.
  • current_depth: Depth of the current node within the book outline. Provided for context.
  • prev_url: URL to the previous node.
  • prev_title: Title of the previous node.
  • parent_url: URL to the parent node.
  • parent_title: Title of the parent node. Not printed by default. Provided as an option.
  • next_url: URL to the next node.
  • next_title: Title of the next node.
  • has_links: Flags TRUE whenever the previous, parent or next data has a value.
  • book_id: The book ID of the current outline being viewed. Same as the node ID containing the entire outline. Provided for context.
  • book_url: The book/node URL of the current outline being viewed. Provided as an option. Not used by default.
  • book_title: The book/node title of the current outline being viewed.

See also

template_preprocess_book_navigation()

olivero_preprocess_book_navigation()

1 theme call to book-navigation.html.twig
book_node_view in core/modules/book/book.module
Implements hook_ENTITY_TYPE_view() for node entities.

File

core/themes/olivero/templates/navigation/book-navigation.html.twig

View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override to navigate books.
  5. *
  6. * Presented under nodes that are a part of book outlines.
  7. *
  8. * Available variables:
  9. * - tree: The immediate children of the current node rendered as an unordered
  10. * list.
  11. * - current_depth: Depth of the current node within the book outline. Provided
  12. * for context.
  13. * - prev_url: URL to the previous node.
  14. * - prev_title: Title of the previous node.
  15. * - parent_url: URL to the parent node.
  16. * - parent_title: Title of the parent node. Not printed by default. Provided
  17. * as an option.
  18. * - next_url: URL to the next node.
  19. * - next_title: Title of the next node.
  20. * - has_links: Flags TRUE whenever the previous, parent or next data has a
  21. * value.
  22. * - book_id: The book ID of the current outline being viewed. Same as the node
  23. * ID containing the entire outline. Provided for context.
  24. * - book_url: The book/node URL of the current outline being viewed. Provided
  25. * as an option. Not used by default.
  26. * - book_title: The book/node title of the current outline being viewed.
  27. *
  28. * @see template_preprocess_book_navigation()
  29. * @see olivero_preprocess_book_navigation()
  30. */
  31. #}
  32. {{ attach_library('olivero/book') }}
  33. {% if tree or has_links %}
  34. <nav id="book-navigation-{{ book_id }}" class="book-navigation" role="navigation" aria-labelledby="book-label-{{ book_id }}">
  35. {{ tree }}
  36. {% if has_links %}
  37. <h2 class="visually-hidden" id="book-label-{{ book_id }}">{{ 'Book traversal links for'|t }} {{ book_title }}</h2>
  38. <ul class="book-pager">
  39. {% if prev_url %}
  40. <li class="book-pager__item book-pager__item--previous">
  41. <a class="book-pager__link book-pager__link--previous" href="{{ prev_url }}" rel="prev" title="{{ 'Go to previous page'|t }}">{{ prev_title }}</a>
  42. </li>
  43. {% endif %}
  44. {% if parent_url %}
  45. <li class="book-pager__item book-pager__item--center">
  46. <a class="book-pager__link book-pager__link--center" href="{{ parent_url }}" title="{{ 'Go to parent page'|t }}">{{ 'Up'|t }}</a>
  47. </li>
  48. {% endif %}
  49. {% if next_url %}
  50. <li class="book-pager__item book-pager__item--next">
  51. <a class="book-pager__link book-pager__link--next" href="{{ next_url }}" rel="next" title="{{ 'Go to next page'|t }}">{{ next_title }}</a>
  52. </li>
  53. {% endif %}
  54. </ul>
  55. {% endif %}
  56. </nav>
  57. {% endif %}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.