annotate core/modules/system/templates/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 * Default theme implementation 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
Chris@0 12 of the <legend>.
Chris@0 13 * - attributes: HTML attributes to apply to the <legend> element.
Chris@0 14 * - description: The description element containing the following properties:
Chris@0 15 * - content: The description content of the <fieldset>.
Chris@0 16 * - attributes: HTML attributes to apply to the description container.
Chris@0 17 * - children: The rendered child elements of the <fieldset>.
Chris@0 18 * - prefix: The content to add before the <fieldset> children.
Chris@0 19 * - suffix: The content to add after the <fieldset> children.
Chris@0 20 *
Chris@0 21 * @see template_preprocess_fieldset()
Chris@0 22 *
Chris@0 23 * @ingroup themeable
Chris@0 24 */
Chris@0 25 #}
Chris@0 26 {%
Chris@0 27 set classes = [
Chris@0 28 'js-form-item',
Chris@0 29 'form-item',
Chris@0 30 'js-form-wrapper',
Chris@0 31 'form-wrapper',
Chris@0 32 ]
Chris@0 33 %}
Chris@0 34 <fieldset{{ attributes.addClass(classes) }}>
Chris@0 35 {%
Chris@0 36 set legend_span_classes = [
Chris@0 37 'fieldset-legend',
Chris@0 38 required ? 'js-form-required',
Chris@0 39 required ? 'form-required',
Chris@0 40 ]
Chris@0 41 %}
Chris@0 42 {# Always wrap fieldset legends in a <span> for CSS positioning. #}
Chris@0 43 <legend{{ legend.attributes }}>
Chris@0 44 <span{{ legend_span.attributes.addClass(legend_span_classes) }}>{{ legend.title }}</span>
Chris@0 45 </legend>
Chris@0 46 <div class="fieldset-wrapper">
Chris@0 47 {% if errors %}
Chris@0 48 <div>
Chris@0 49 {{ errors }}
Chris@0 50 </div>
Chris@0 51 {% endif %}
Chris@0 52 {% if prefix %}
Chris@0 53 <span class="field-prefix">{{ prefix }}</span>
Chris@0 54 {% endif %}
Chris@0 55 {{ children }}
Chris@0 56 {% if suffix %}
Chris@0 57 <span class="field-suffix">{{ suffix }}</span>
Chris@0 58 {% endif %}
Chris@0 59 {% if description.content %}
Chris@0 60 <div{{ description.attributes.addClass('description') }}>{{ description.content }}</div>
Chris@0 61 {% endif %}
Chris@0 62 </div>
Chris@0 63 </fieldset>