diff --git a/core/themes/starterkit_theme/templates/form/fieldset.html.twig b/core/themes/starterkit_theme/templates/form/fieldset.html.twig index 75033edcf1aee60aea8d59a3bc8f6d5e83ceba03..7e705b2c4bbee4670e7d7ed6eeeaf1db0e687db2 100644 --- a/core/themes/starterkit_theme/templates/form/fieldset.html.twig +++ b/core/themes/starterkit_theme/templates/form/fieldset.html.twig @@ -4,18 +4,24 @@ * 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 fieldset 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. + * - attributes: HTML attributes for the <fieldset> element. + * - errors: (optional) Any errors for this <fieldset> element, may not be set. + * - required: Boolean indicating whether the <fieldset> 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> element. * - description: The description element containing the following properties: - * - content: The description content of the fieldset. + * - 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. + * - description_display: Description display setting. It can have these values: + * - before: The description is output before the element. + * - after: The description is output after the element (default). + * - invisible: The description is output after the element, hidden visually + * but available to screen readers. + * - 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() */ @@ -41,6 +47,9 @@ <span{{ legend_span.attributes.addClass(legend_span_classes) }}>{{ legend.title }}</span> </legend> <div class="fieldset-wrapper"> + {% if description_display == 'before' and description.content %} + <div{{ description.attributes.addClass('description') }}>{{ description.content }}</div> + {% endif %} {% if errors %} <div class="form-item--error-message"> <strong>{{ errors }}</strong> @@ -53,7 +62,7 @@ {% if suffix %} <span class="field-suffix">{{ suffix }}</span> {% endif %} - {% if description.content %} + {% if description_display in ['after', 'invisible'] and description.content %} <div{{ description.attributes.addClass('description') }}>{{ description.content }}</div> {% endif %} </div>