{#
/**
 * @file
 * Dark+'s theme override for the content collapses field
 *
 * @see darkplus_preprocess_field__field_mt_content_collapses()
 */
#}
{%
  set classes = [
    'field',
    'field--name-' ~ field_name|clean_class,
    'field--type-' ~ field_type|clean_class,
    'field--label-' ~ label_display,
  ]
%}
{%
  set title_classes = [
    'field__label',
    label_display == 'visually_hidden' ? 'visually-hidden',
  ]
%}
{{ attach_library('darkplus/field-mt-prd-content-collapses') }}
<div{{ attributes.addClass(classes) }}>
  {% if not label_hidden %}
    <h3{{ title_attributes.addClass(title_classes) }}>{{ label }}</h3>
  {% endif %}
  <div class="collapse-group collapse-group--style-2" id="mt-content-collapse" role="tablist" aria-multiselectable="true">
    {% for item in items %}
      <div class="card">
        <div class="card-header card-header--trigger-icon" role="tab" id="heading-id-{{loop.index}}">
          <div class="card-title">
            <a class="{{ loop.first ? '' : ' collapsed' }}" data-toggle="collapse" href="#collapse-id-{{loop.index}}" aria-expanded="true" aria-controls="collapse-id-{{loop.index}}">
              {{ item.content['#paragraph'].get('field_mt_collapse_title').value }}
            </a>
          </div>
        </div>
        <div id="collapse-id-{{loop.index}}" class="collapse {{ loop.first ? ' show' : '' }}" role="tabpanel" aria-labelledby="heading-id-{{loop.index}}" data-parent="#mt-content-collapse">
          <div class="card-body">
            {{ item.content }}
          </div>
        </div>
      </div>
    {% endfor %}
  </div>
</div>
