better_exposed_filters-8.x-4.x-dev/templates/bef-nested-elements.html.twig

templates/bef-nested-elements.html.twig
{#
  Themes hierarchical taxonomy terms as nested <ul> elements.

  This template is intended to be called from within another template to provide
  the "scaffolding" of nested lists while the calling template provides the
  actual filter element via the 'item' variable.

  Available variables:
    - current_nesting_level: the nesting level of the most recently printe item.
    - new_nesting_level: the nesting level of the item to print.
    - item: The item to print.
    - loop: The loop variable from the iterator that calls this template.
      Requires the loop.first and loop.last elements.
#}
{% set delta = (current_nesting_level - new_nesting_level) | abs %}
{% if loop.first %}
  <ul>
{% else %}
  {% if delta %}
    {% for i in 1..delta %}
      {% if new_nesting_level > current_nesting_level  %}
        <ul>
      {% else %}
        </ul>
      {% endif %}
    {% endfor %}
  {% endif %}
{% endif %}

<li>{{ item }}

{% if loop.last %}
  {# Close any remaining <li> tags #}
  {% for i in new_nesting_level..0 %}
    </li></ul>
  {% endfor %}
{% endif %}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc