book-navigation.html.twig

Default theme implementation 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. Provided as an option. Not used by default.

See also

template_preprocess()

template_preprocess_book_navigation()

1 theme call to book-navigation.html.twig
book_node_view in drupal/core/modules/book/book.module
Implements hook_node_view().

File

drupal/core/modules/book/templates/book-navigation.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation 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. * Provided as an option. Not used by default.
  28. *
  29. * @see template_preprocess()
  30. * @see template_preprocess_book_navigation()
  31. *
  32. * @ingroup themeable
  33. */
  34. #}
  35. {% if tree or has_links %}
  36. <nav id="book-navigation-{{ book_id }}" class="book-navigation">
  37. {{ tree }}
  38. {% if has_links %}
  39. <h2 class="element-invisible">{{ 'Book Navigation'|t }}</h2>
  40. <ul class="book-pager">
  41. {% if prev_url %}
  42. <li class="previous">
  43. <a href="{{ prev_url }}" rel="prev" title="{{ 'Go to previous page'|t }}"><b>{{ '‹'|t }}</b> {{ prev_title }}</a>
  44. </li>
  45. {% endif %}
  46. {% if parent_url %}
  47. <li class="up">
  48. <a href="{{ parent_url }}" title="{{ 'Go to parent page'|t }}">{{ 'Up'|t }}</a>
  49. </li>
  50. {% endif %}
  51. {% if next_url %}
  52. <li class="next">
  53. <a href="{{ next_url }}" rel="next" title="{{ 'Go to next page'|t }}">{{ next_title }} <b>{{ '›'|t }}</b></a>
  54. </li>
  55. {% endif %}
  56. </ul>
  57. {% endif %}
  58. </nav>
  59. {% endif %}

Related topics