book-navigation.html.twig 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. */
  30. #}
  31. {% if tree or has_links %}
  32. <nav id="book-navigation-{{ book_id }}" class="book-navigation" role="navigation" aria-labelledby="book-label-{{ book_id }}">
  33. {{ tree }}
  34. {% if has_links %}
  35. <h2 class="visually-hidden" id="book-label-{{ book_id }}">{{ 'Book traversal links for'|t }} {{ book_title }}</h2>
  36. <ul class="book-pager">
  37. {% if prev_url %}
  38. <li class="book-pager__item book-pager__item--previous">
  39. <a href="{{ prev_url }}" rel="prev" title="{{ 'Go to previous page'|t }}"><b>{{ '‹'|t }}</b> {{ prev_title }}</a>
  40. </li>
  41. {% endif %}
  42. {% if parent_url %}
  43. <li class="book-pager__item book-pager__item--center">
  44. <a href="{{ parent_url }}" title="{{ 'Go to parent page'|t }}">{{ 'Up'|t }}</a>
  45. </li>
  46. {% endif %}
  47. {% if next_url %}
  48. <li class="book-pager__item book-pager__item--next">
  49. <a href="{{ next_url }}" rel="next" title="{{ 'Go to next page'|t }}">{{ next_title }} <b>{{ '›'|t }}</b></a>
  50. </li>
  51. {% endif %}
  52. </ul>
  53. {% endif %}
  54. </nav>
  55. {% endif %}