4 * Theme override to display a book tree.
6 * Returns HTML for a wrapper for a book sub-tree.
9 * - items: A nested list of book items. Each book item contains:
10 * - attributes: HTML attributes for the book item.
11 * - below: The book item child items.
12 * - title: The book link title.
13 * - url: The book link URL, instance of \Drupal\Core\Url.
14 * - is_expanded: TRUE if the link has visible children within the current
16 * - is_collapsed: TRUE if the link has children within the current book tree
17 * that are not currently visible.
18 * - in_active_trail: TRUE if the link is in the active trail.
21 {% import _self as book_tree %}
24 We call a macro which calls itself to render the full tree.
25 @see http://twig.sensiolabs.org/doc/tags/macro.html
27 {{ book_tree.book_links(items, attributes, 0) }}
29 {% macro book_links(items, attributes, menu_level) %}
30 {% import _self as book_tree %}
32 {% if menu_level == 0 %}
33 <ul{{ attributes.addClass('menu') }}>
37 {% for item in items %}
41 item.is_expanded ? 'menu-item--expanded',
42 item.is_collapsed ? 'menu-item--collapsed',
43 item.in_active_trail ? 'menu-item--active-trail',
46 <li{{ item.attributes.addClass(classes) }}>
47 {{ link(item.title, item.url) }}
49 {{ book_tree.book_links(item.below, attributes, menu_level + 1) }}