iu-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.
 *
 * Move the fieldset description above the containing fields.
 *
 * 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-item',
    'form-item',
    'js-form-wrapper',
    'form-wrapper',
    attributes.hasClass('form-composite') ?: 'fieldset'
  ]
%}
<fieldset{{ attributes.addClass(classes) }}>
  {%
    set legend_span_classes = [
      'fieldset-legend',
      required ? 'js-form-required',
      required ? 'form-required',
      errors ? 'is-invalid-label'
    ]
  %}
  {#  Always wrap fieldset legends in a SPAN for CSS positioning. #}
  <legend{{ legend.attributes }}>
    <span{{ legend_span.attributes.addClass(legend_span_classes) }}>{{ legend.title }}&nbsp;<span class="required-marker form-required-marker">*</span></span>
  </legend>
  <div class="fieldset-wrapper">
    {% if description.content %}
      <div{{ description.attributes }}>{{ description.content }}</div>
    {% endif %}
    {% if errors %}
      <div class="form-item--error-message form-error is-visible">
        {{ errors }}
      </div>
    {% endif %}
    {% if prefix %}
      <span class="field-prefix">{{ prefix }}</span>
    {% endif %}
    {{ children }}
    {% if suffix %}
      <span class="field-suffix">{{ suffix }}</span>
    {% endif %}
  </div>
</fieldset>

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

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