a12s-1.0.0-beta7/modules/patterns/templates/patterns/accordion/pattern-accordion.html.twig

modules/patterns/templates/patterns/accordion/pattern-accordion.html.twig
{% set default_classes = [
  'accordion',
  variant is not empty ? 'accordion--' ~ variant
] %}

{% if namespace is empty %}
  {% set namespace = random(10000, 99999) %}
{% endif %}

{% if sections %}
  <div{{ attributes.addClass(classes|default(default_classes)) }}>
  {% for index, section in sections %}
    {% set section_attributes = create_attribute({
      class: ["accordion-toggle"],
      type: "button",
      id: "accordion-" ~ namespace ~ "-" ~ index,
      "aria-expanded": index in active_sections ? "true" : "false",
      "aria-controls": "accordion-" ~ namespace ~ "-panel-" ~ index,
    }) %}
    <button{{ section_attributes.addClass(section.section_classes|default([])) }}>{{ section.label }}</button>

    {% set panel_attributes = create_attribute({
      class: [
        "accordion-panel",
        index in active_sections ? "show",
      ],
      id: "accordion-" ~ namespace ~ "-panel-" ~ index,
      role: "region",
      "aria-labelledby": "accordion-" ~ namespace ~ "-" ~ index,
    }) %}
    <div{{ panel_attributes.addClass(section.panel_classes|default([])) }}>
      {{ section.content }}
    </div>
  {% endfor %}

</div>
{% endif %}

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

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