localgov_step_by_step-2.1.10/templates/views-view-list--localgov-step-by-step-navigation--prev-next.html.twig
templates/views-view-list--localgov-step-by-step-navigation--prev-next.html.twig
{#
/**
* @file
* Theme implementation for a view template to display a list of rows.
*
* Applies to the *Step by step* View's "Prev/Next block" display only.
* Changes include:
* - Display only *two* list items at most: One for the previous step node and
* another for the next step node.
* - Instead of the Step title, display Prev or Next.
* - On the very first step, use "Start" instead of "Next".
* - Apply the "step--next" and "step--prev" classes on appropriate list items.
*
* Available variables:
* - attributes: HTML attributes for the container.
* - rows: A list of rows for this list.
* - attributes: The row's HTML attributes.
* - content: The row's contents.
* - view: The view object.
* - title: The title of this group of rows. May be empty.
* - list: @todo.
* - type: Starting tag will be either a ul or ol.
* - attributes: HTML attributes for the list element.
* - has_prev_step: Have we got a previous step node?
* - has_next_step: Have we got a ntext step node?
* - prev_step_nid: Node Id of the previous node, if any.
* - next_step_nid: Node Id of the next node, if any.
* - prev_step_index: Array index of the previous node, if any.
* - next_step_index: Array index of the next node, if any.
* - prev_step_link_text: Prev
* - next_step_link_text: Start|Next
*
* @see template_preprocess_views_view_list()
*
* @ingroup themeable
*/
#}
{% set has_wrapper_attributes = attributes.toString() %}
{% if has_wrapper_attributes -%}
<div{{ attributes }}>
{% endif %}
{% if title %}
<h3>{{ title }}</h3>
{% endif %}
<{{ list.type }}{{ list.attributes }}>
{% if has_prev_step %}
<li{{ rows[prev_step_index].attributes.addClass('step--prev') }}>
<a href="{{ path('entity.node.canonical', {'node': prev_step_nid }) }}" class="btn btn-carbon" aria-label="Previous step: {{ prev_step_title }}"><span class="fa fa-chevron-left"></span>{{ prev_step_link_text }}</a>
</li>
{% endif %}
{% if has_next_step %}
<li{{ rows[next_step_index].attributes.addClass('step--next') }}>
<a href="{{ path('entity.node.canonical', {'node': next_step_nid }) }}" class="btn btn-primary" aria-label="Next step: {{ next_step_title }}"><span class="fa fa-chevron-right"></span>{{ next_step_link_text }}</a>
</li>
{% endif %}
</{{ list.type }}>
{% if has_wrapper_attributes -%}
</div>
{% endif %}
