views-bootstrap-accordion.html.twig in Views Bootstrap 8.3
{% set title_attributes = create_attribute({'class': ['accordion-toggle']}) %}
{% if group_title %}<h3>{{ group_title }}</h3>{% endif %}
<div {{ attributes.addClass(classes).setAttribute('id', id).setAttribute('role', 'tablist').setAttribute('aria-multiselectable', 'true') }}>
{% for key, row in rows -%}
{% set expanded = (behavior == 'first' and loop.first) or behavior == 'all' ? true : false %}
{% set title_class = [expanded == false ? 'collapsed' : ''] %}
<div class="panel panel-default">
<div class="panel-heading" {{ attributes.addClass('panel-heading').setAttribute('role', 'tab').setAttribute('id', 'heading' ~ id ~ '-collapse-' ~ key) }}>
<h4 class="panel-title">
<a {{ title_attributes.addClass(title_class) }}
role="button"
data-toggle="collapse"
data-parent="#{{ id }}"
aria-expanded="{{ expanded }}"
aria-controls="{{ id }}-collapse-{{ key }}"
href="#{{ id }}-collapse-{{ key }}">
{{row.title}}
</a>
{% if row.label %}
<span class="badge pull-right">{{ row.label }}</span>
{% endif %}
</h4>
</div>
<div id="{{ id }}-collapse-{{ key }}" class="panel-collapse collapse {{ expanded == 'true' ? 'in' }}" role="tabpanel" aria-labelledby="heading{{ id }}-collapse-{{ key }}">
<div class="panel-body">
{{row.content}}
</div>
</div>
</div>
{%- endfor %}
</div>
File
templates/views-bootstrap-accordion.html.twig
View source
- {% set title_attributes = create_attribute({'class': ['accordion-toggle']}) %}
- {% if group_title %}<h3>{{ group_title }}</h3>{% endif %}
- <div {{ attributes.addClass(classes).setAttribute('id', id).setAttribute('role', 'tablist').setAttribute('aria-multiselectable', 'true') }}>
- {% for key, row in rows -%}
- {% set expanded = (behavior == 'first' and loop.first) or behavior == 'all' ? true : false %}
- {% set title_class = [expanded == false ? 'collapsed' : ''] %}
- <div class="panel panel-default">
- <div class="panel-heading" {{ attributes.addClass('panel-heading').setAttribute('role', 'tab').setAttribute('id', 'heading' ~ id ~ '-collapse-' ~ key) }}>
- <h4 class="panel-title">
- <a {{ title_attributes.addClass(title_class) }}
- role="button"
- data-toggle="collapse"
- data-parent="#{{ id }}"
- aria-expanded="{{ expanded }}"
- aria-controls="{{ id }}-collapse-{{ key }}"
- href="#{{ id }}-collapse-{{ key }}">
- {{row.title}}
- </a>
- {% if row.label %}
- <span class="badge pull-right">{{ row.label }}</span>
- {% endif %}
- </h4>
- </div>
-
- <div id="{{ id }}-collapse-{{ key }}" class="panel-collapse collapse {{ expanded == 'true' ? 'in' }}" role="tabpanel" aria-labelledby="heading{{ id }}-collapse-{{ key }}">
- <div class="panel-body">
- {{row.content}}
- </div>
- </div>
- </div>
- {%- endfor %}
- </div>