book_blocks-8.x-1.4/templates/book-blocks-edit.html.twig
templates/book-blocks-edit.html.twig
{#
/**
* @file
* 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.
* - css: additional css class
* - icons: use icons instead of text
* - toc: include tables of contents
* - nav: include nav buttons
* - left_link: link array, keys are ['name', 'url', 'hint']
* - middle_link: link array
* - right_link: link array
* - siblingi_link: link array
* - child_link: link array
* - print_link: link array
* - module_path: module path for images
* - my_element_id: matching element
*
* @see template_preprocess_book_blocks_edit()
*/
#}
{% set icons_css = icons ? 'book-blocks-icons' : 'book-blocks-text' %}
{%
set nav_classes = [
'book-blocks-edit',
css,
icons_css
]
%}
{%
set pager_classes = [
'links',
'inline',
]
%}
<nav id="book-navigation-{{ book_id }}" class="{{ nav_classes|join(' ') }}" role="navigation" aria-labelledby="book-label-{{ book_id }}">
<h2 class="visually-hidden" id="book-label-{{ book_id }}">{{ 'Book edit links for'|t }} {{ book_title }}</h2>
<ul class="{{ pager_classes|join(' ') }}">
{% if left_link %}
<li class="book-blocks-left">
<span class="book-blocks-left__link-wrapper">
<a href="{{ left_link.url }}" title="{{ left_link.hint }}">{{ left_link.name }}</a>
</span>
</li>
{% endif %}
{% if toc %}
<li class="book-blocks-toc">
<span class="book-blocks-toc__link-wrapper {{ my_element_id }}">
<span onclick="var e = getElementById('{{ my_element_id }}'); e.style.visibility=e.style.visibility=='hidden'?'visible':'hidden';" title="{{ 'Click to show Table of Contents'|t }}">{{ 'Table of Contents'|t }}</span>
</span>
</li>
{% endif %}
{% if middle_link %}
<li class="book-blocks-middle">
<span class="book-blocks-middle__link-wrapper">
<a href="{{ middle_link.url }}" title="{{ middle_link.hint }}">{{ middle_link.name }}</a>
</span>
</li>
{% endif %}
{% if nav %}
<li class="book-blocks-nav-item book-blocks-nav-prev">
<span class="book-blocks-nav__link-wrapper">
{% if prev_url %}
<a href="{{ prev_url }}" class="book-blocks-enabled {{ icons_css }}" rel="prev" title="{{ prev_title }}">
{% if icons %}
<img src="{{ module_path }}/images/left.png" alt="«">
{% else %}
«
{% endif %}
</a>
{% else %}
<a href="#" class="book-blocks-disabled {{ icons_css }}">
{% if icons %}
<img src="{{ module_path }}/images/left.png" alt="«">
{% else %}
X
{% endif %}
</a>
{% endif %}
</span>
</li>
<li class="book-blocks-nav-item book-blocks-nav-up">
<span class="book-blocks-nav__link-wrapper">
{% if parent_url %}
<a href="{{ parent_url }}" class="book-blocks-enabled {{ icons_css }}" rel="prev" title="{{ parent_title }}">
{% if icons %}
<img src="{{ module_path }}/images/up.png" alt="^">
{% else %}
^
{% endif %}
</a>
{% else %}
<a href="#" class="book-blocks-disabled {{ icons_css }}">
{% if icons %}
<img src="{{ module_path }}/images/up.png" alt="^">
{% else %}
X
{% endif %}
</a>
{% endif %}
</span>
</li>
<li class="book-blocks-nav-item book-blocks-nav-next">
<span class="book-blocks-nav__link-wrapper">
{% if next_url %}
<a href="{{ next_url }}" class="book-blocks-enabled {{ icons_css }}" rel="prev" title="{{ next_title }}">
{% if icons %}
<img src="{{ module_path }}/images/right.png" alt="»">
{% else %}
»
{% endif %}
</a>
{% else %}
<a href="#" class="book-blocks-disabled {{ icons_css }}">
{% if icons %}
<img src="{{ module_path }}/images/right.png" alt="»">
{% else %}
X
{% endif %}
</a>
{% endif %}
</span>
</li>
{% endif %}
{% if sibling_link %}
<li class="book-blocks-add-sibling">
<span class="book-blocks-add-sibling__link-wrapper">
<a href="{{ sibling_link.url }}" class="{{ icons_css }}" title="{{ sibling_link.hint }}">
{% if icons %}
<img src="{{ module_path }}/images/add_sibling.png" alt="{{ sibling_link.name }}">
{% else %}
{{ sibling_link.name }}
{% endif %}
</a>
</span>
</li>
{% endif %}
{% if child_link %}
<li class="book-add-child">
<span class="book-add-child__link-wrapper">
<a href="{{ child_link.url }}" class="{{ icons_css }}" title="{{ child_link.hint }}">
{% if icons %}
<img src="{{ module_path }}/images/add_child.png" alt="{{ child_link.name }}">
{% else %}
{{ child_link.name }}
{% endif %}
</a>
</span>
</li>
{% endif %}
{% if print_link %}
<li class="book-printer">
<span class="book-printer__link-wrapper">
<a href="{{ print_link.url }}" class="{{ icons_css }}" title="{{ print_link.hint }}">
{% if icons %}
<img src="{{ module_path }}/images/print.png" alt="{{ print_link.name }}">
{% else %}
{{ print_link.name }}
{% endif %}
</a>
</span>
</li>
{% endif %}
{% if right_link %}
<li class="book-blocks-right">
<span class="book-blocks-right__link-wrapper">
<a href="{{ right_link.url }}" title="{{ right_link.hint }}">{{ right_link.name }}</a>
</span>
</li>
{% endif %}
</ul>
</nav>
