bs_base-8.x-1.x-dev/templates/form/fieldset.html.twig

templates/form/fieldset.html.twig
{#
/**
 * @file
 * Theme override for a fieldset element and its children.
 *
 * Available variables:
 * - attributes: HTML attributes for the fieldset element.
 * - errors: (optional) Any errors for this fieldset element, may not be set.
 * - required: Boolean indicating whether the fieldeset element is required.
 * - legend: The legend element containing the following properties:
 *   - title: Title of the fieldset, intended for use as the text of the legend.
 *   - attributes: HTML attributes to apply to the legend.
 * - description: The description element containing the following properties:
 *   - content: The description content of the fieldset.
 *   - attributes: HTML attributes to apply to the description container.
 * - children: The rendered child elements of the fieldset.
 * - prefix: The content to add before the fieldset children.
 * - suffix: The content to add after the fieldset children.
 *
 * @see template_preprocess_fieldset()
 */
#}
{%
  set classes = [
    'js-form-wrapper',
    'form-wrapper',
  ]
%}
{# Cover the case when field_group formatter is used. In the case of 'Mark group
   as required' if group has required fields field_group will add required-fields
   class. For this case we will set required flag to true. #}
{% if attributes.hasClass('required-fields') %}
  {% set required = true %}
{% endif %}
<fieldset{{ attributes.addClass(classes) }}>
  {% if legend.title -%}
    {%
      set legend_span_classes = [
        'fieldset-legend',
        required ? 'js-form-required',
        required ? 'form-required',
      ]
    %}
    {% block fieldset_legend %}
      <legend{{ legend.attributes }}>
        {#- Wrap fieldset legends in a <span> for CSS positioning. -#}
        <span{{ legend_span.attributes.addClass(legend_span_classes) }}>{{ legend.title }}</span>{% if required and  title_display != 'invisible' %}<span class="form-required-mark"></span>{% endif -%}
      </legend>
    {% endblock %}
  {%- endif %}
  {% block fieldset_wrapper %}
    <div class="fieldset-wrapper">
      {% if errors %}
        <div class="invalid-feedback">
          {{ errors }}
        </div>
      {% endif %}
      {% block fieldset_content %}
        {% if prefix %}
          <span class="field-prefix">{{ prefix }}</span>
        {% endif %}
        {{ children }}
        {% if suffix %}
          <span class="field-suffix">{{ suffix }}</span>
        {% endif %}
        {% if description.content %}
          <div{{ description.attributes.addClass('description') }}>{{ description.content }}</div>
        {% endif %}
      {% endblock %}
    </div>
  {% endblock %}
</fieldset>

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

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