annotate core/themes/classy/templates/form/fieldset.html.twig @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 {#
Chris@0 2 /**
Chris@0 3 * @file
Chris@0 4 * Theme override for a fieldset element and its children.
Chris@0 5 *
Chris@0 6 * Available variables:
Chris@0 7 * - attributes: HTML attributes for the fieldset element.
Chris@0 8 * - errors: (optional) Any errors for this fieldset element, may not be set.
Chris@0 9 * - required: Boolean indicating whether the fieldeset element is required.
Chris@0 10 * - legend: The legend element containing the following properties:
Chris@0 11 * - title: Title of the fieldset, intended for use as the text of the legend.
Chris@0 12 * - attributes: HTML attributes to apply to the legend.
Chris@0 13 * - description: The description element containing the following properties:
Chris@0 14 * - content: The description content of the fieldset.
Chris@0 15 * - attributes: HTML attributes to apply to the description container.
Chris@0 16 * - children: The rendered child elements of the fieldset.
Chris@0 17 * - prefix: The content to add before the fieldset children.
Chris@0 18 * - suffix: The content to add after the fieldset children.
Chris@0 19 *
Chris@0 20 * @see template_preprocess_fieldset()
Chris@0 21 */
Chris@0 22 #}
Chris@0 23 {%
Chris@0 24 set classes = [
Chris@0 25 'js-form-item',
Chris@0 26 'form-item',
Chris@0 27 'js-form-wrapper',
Chris@0 28 'form-wrapper',
Chris@0 29 ]
Chris@0 30 %}
Chris@0 31 <fieldset{{ attributes.addClass(classes) }}>
Chris@0 32 {%
Chris@0 33 set legend_span_classes = [
Chris@0 34 'fieldset-legend',
Chris@0 35 required ? 'js-form-required',
Chris@0 36 required ? 'form-required',
Chris@0 37 ]
Chris@0 38 %}
Chris@0 39 {# Always wrap fieldset legends in a <span> for CSS positioning. #}
Chris@0 40 <legend{{ legend.attributes }}>
Chris@0 41 <span{{ legend_span.attributes.addClass(legend_span_classes) }}>{{ legend.title }}</span>
Chris@0 42 </legend>
Chris@0 43 <div class="fieldset-wrapper">
Chris@0 44 {% if errors %}
Chris@0 45 <div class="form-item--error-message">
Chris@0 46 <strong>{{ errors }}</strong>
Chris@0 47 </div>
Chris@0 48 {% endif %}
Chris@0 49 {% if prefix %}
Chris@0 50 <span class="field-prefix">{{ prefix }}</span>
Chris@0 51 {% endif %}
Chris@0 52 {{ children }}
Chris@0 53 {% if suffix %}
Chris@0 54 <span class="field-suffix">{{ suffix }}</span>
Chris@0 55 {% endif %}
Chris@0 56 {% if description.content %}
Chris@0 57 <div{{ description.attributes.addClass('description') }}>{{ description.content }}</div>
Chris@0 58 {% endif %}
Chris@0 59 </div>
Chris@0 60 </fieldset>