Skip to content
This repository was archived by the owner on Jan 7, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions templates/form_element/form-element.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,27 @@
* @see template_preprocess_form_element()
*/
#}
{%
set description_classes = [
'description',
description_display == 'invisible' ? 'visually-hidden',
'form-text',
'small',
'text-muted',
]
%}
<div {{ attributes }}>
{% if label_display in ['before', 'invisible'] %}
{{ label }}
{% endif %}
{% if prefix is not empty %}
<span class="field-prefix">{{ prefix }}</span>
{% endif %}
{% if description_display == 'before' and description.content %}
<div{{ description.attributes.addClass(description_classes) }}>
{{ description.content }}
</div>
{% endif %}
{{ children }}
{% if suffix is not empty %}
<span class="field-suffix">{{ suffix }}</span>
Expand All @@ -63,7 +77,9 @@
{{ errors }}
</div>
{% endif %}
{% if description.content %}
<small class="form-text text-muted">{{ description.content }}</small>
{% if description_display in ['after', 'invisible'] and description.content %}
<div{{ description.attributes.addClass(description_classes) }}>
{{ description.content }}
</div>
{% endif %}
</div>