camaleon-8.x-1.x-dev/templates/form/fieldset.html.twig
templates/form/fieldset.html.twig
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | {# /** * @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-item' , 'form-item' , 'js-form-wrapper' , 'form-wrapper' , ] %} <fieldset{{ attributes.addClass(classes) }}> {% set legend_span_classes = [ 'fieldset-legend' , required ? 'js-form-required' , required ? 'form-required' , ] %} {# Always wrap fieldset legends in a <span> for CSS positioning. #} <legend{{ legend.attributes }}> <span{{ legend_span.attributes.addClass(legend_span_classes) }}>{{ legend.title }}</span> </legend> <div class = "fieldset-wrapper" > {% if errors %} <div class = "form-item--error-message" > <strong>{{ errors }}</strong> </div> {% endif %} {% 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 %} </div> </fieldset> |