2015-08-17 17:00:26 -07:00
{ #
/**
* @file
* Default theme implementation for a fieldset element and its children.
*
* Available variables:
2016-06-02 15:56:09 -07:00
* - 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> element.
2015-08-17 17:00:26 -07:00
* - description: The description element containing the following properties:
2016-06-02 15:56:09 -07:00
* - content: The description content of the <fieldset>.
2015-08-17 17:00:26 -07:00
* - attributes: HTML attributes to apply to the description container.
2016-06-02 15:56:09 -07:00
* - 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.
2015-08-17 17:00:26 -07:00
*
* @see template_preprocess_fieldset()
*
* @ingroup themeable
*/
#}
{ %
set classes = [
2015-10-08 11:40:12 -07:00
'js-form-item',
2015-08-17 17:00:26 -07:00
'form-item',
'js-form-wrapper',
'form-wrapper',
]
%}
<fieldset {{ attributes .addClass ( classes ) }} >
{ %
set legend_span_classes = [
'fieldset-legend',
2015-09-04 13:20:09 -07:00
required ? 'js-form-required',
2015-08-17 17:00:26 -07:00
required ? 'form-required',
]
%}
2016-06-02 15:56:09 -07:00
{# Always wrap fieldset legends in a <span> for CSS positioning. #}
2015-08-17 17:00:26 -07:00
<legend {{ legend .attributes }} >
<span {{ legend_span .attributes .addClass ( legend_span_classes ) }} > {{ legend .title }} </span>
</legend>
<div class="fieldset-wrapper">
{% if errors %}
<div>
{{ errors }}
</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>