rivet-1.0.x-dev/templates/form/form-element--item.html.twig
templates/form/form-element--item.html.twig
{#
/**
* @file
* Theme override for a form 'item' element.
*/
#}
{%
set classes = [
'js-form-item',
'form-item',
'js-form-type-' ~ type|clean_class,
'form-type-' ~ type|clean_class,
'js-form-item-' ~ name|clean_class,
'form-item-' ~ name|clean_class,
title_display not in ['after', 'before'] ? 'form-no-label',
disabled == 'disabled' ? 'form-disabled',
errors ? 'form-item--error',
]
%}
{%
set description_classes = [
'rvt-c-description',
'rvt-c-description--' ~ description_display|clean_class,
description_display == 'invisible' ? 'rvt-sr-only',
]
%}
<div{{ attributes.addClass(classes) }}>
{% if label_display in ['before', 'invisible'] %}
{{ label }}
{% endif %}
{% if description_display == 'before' and description.content %}
<div{{ description.attributes.addClass(description_classes) }}>
{{ description.content }}
</div>
{% endif %}
{# {% if prefix is not empty or suffix is not empty %} #}
<div class="rvt-flex rvt-border-all rvt-p-all-xs rvt-border-radius">
{# {% endif %} #}
{% if prefix is not empty %}
<span class="field-prefix">{{ prefix }}</span>
{% endif %}
<div class="field-item rvt-flow">{{ children }}</div>
{% if suffix is not empty %}
<span class="field-suffix">{{ suffix }}</span>
{% endif %}
{# {% if prefix is not empty or suffix is not empty %} #}
</div>
{# {% endif %} #}
{% if label_display == 'after' %}
{{ label }}
{% endif %}
{% if errors %}
<div class="rvt-inline-alert rvt-inline-alert--danger">
<span class="rvt-inline-alert__icon">
<svg fill="currentColor" width="16" height="16" viewBox="0 0 16 16"><path d="m8 6.586-2-2L4.586 6l2 2-2 2L6 11.414l2-2 2 2L11.414 10l-2-2 2-2L10 4.586l-2 2Z"></path><path d="M8 0a8 8 0 1 0 0 16A8 8 0 0 0 8 0ZM2 8a6 6 0 1 1 12 0A6 6 0 0 1 2 8Z"></path></svg>
</span>
<span class="rvt-inline-alert__message">{{ errors }}</span>
</div>
{% endif %}
{% if description_display in ['after', 'invisible'] and description.content %}
<div{{ description.attributes.addClass(description_classes) }}>
{{ description.content }}
</div>
{% endif %}
</div>
