bootstrap_italia-8.x-0.x-dev/templates/form/webform/details--webform.html.twig

templates/form/webform/details--webform.html.twig
{#
/**
 * @file
 * Default theme implementation for a details element.
 * Docs: https://italia.github.io/bootstrap-italia/docs/componenti/accordion/
 * Latest revision: v2.0.8
 *
 * Available variables
 * - attributes: A list of HTML attributes for the details element.
 * - errors: (optional) Any errors for this details element, may not be set.
 * - title: (optional) The title of the element, may not be set.
 * - summary_attributes: A list of HTML attributes for the summary element.
 * - description: (optional) The description of the element, may not be set.
 * - children: (optional) The children of the element, may not be set.
 * - value: (optional) The value of the element, may not be set.
 *
 * @see template_preprocess_details()
 *
 * @ingroup themeable
 */
#}
{% set form_accordion_id = 'form-accordion-' ~ random() %}
{% set form_accordion_title_id = form_accordion_id ~ '-title' %}
{% set form_accordion_collapse_id = form_accordion_id ~ '-collapse' %}
{% set attributes = attributes
  .setAttribute('id', form_accordion_id)
  .addClass(['accordion', 'accordion-left-icon', 'accordion-background-hover'])
%}
<div{{ attributes }}>
  <div class="accordion-item">

    {% set summary_classes = [
      required ? 'js-form-required',
      required ? 'form-required',
      'accordion-header'
    ] %}
    {% set summary_attributes = summary_attributes
      .setAttribute('id', form_accordion_title_id)
      .addClass(summary_classes)
    %}

    <h2{{ summary_attributes }}>
      <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#{{ form_accordion_collapse_id }}" aria-expanded="false" aria-controls="{{ form_accordion_collapse_id }}">
        {%- if title -%}
          {{ title }}
        {% else %}
          {{ 'Details'|t }}
        {% endif %}
      </button>
    </h2>
    <div id="{{ form_accordion_collapse_id }}" class="accordion-collapse collapse pt-3" role="region" aria-labelledby="{{ form_accordion_title_id }}">
      <div class="accordion-body">
        {% if errors %}
          <div>
            {{ errors }}
          </div>
        {% endif %}

        {% if description %}
          <div class="mb-5">
            {{ description }}
          </div>
        {% endif %}

        {{ children }}
        {{ value }}
      </div>
    </div>
  </div>
</div>

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

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