webseite-grav/plugins/form/templates/forms/layouts/field.html.twig

54 lines
2.1 KiB
Twig

{% block field %}
<div class="form-field {{ layout_form_field_outer_classes|trim }} {{ form_field_outer_core|trim}}">
{% block contents %}
{% if show_label %}
<div class="{{- layout_form_field_outer_label_classes -}}">
{{- form_field_toggleable -}}
<label class="{{ layout_form_field_label_classes }}{{ form_field_label_trim }}" {% if field.id %}for="{{ form_field_for }}"{% endif %}>
{%- block label -%}
{%- if form_field_help -%}
<span class="tooltip" data-tooltip="{{ form_field_help|e }}">{{ form_field_label|raw }}</span>
{%- else -%}
{{ form_field_label|raw }}
{%- endif -%}
{%- if form_field_required %}
<span class="required">*</span>
{%- endif -%}
{%- endblock -%}
</label>
</div>
{% endif %}
<div class="{{ layout_form_field_outer_data_classes }}"
{% block global_attributes %}{% endblock %}
>
{% block group %}
{% block input %}
<div class="{{ layout_form_field_wrapper_classes }} {{ field.size }}">
{% block prepend %}{% endblock prepend %}
{% set input_value = value is iterable ? value|join(',') : value|string %}
<input
name="{{ (scope ~ field.name)|fieldName }}"
value="{{ input_value|e }}"
{% block input_attributes %}{% endblock %}
/>
{% block append %}{% endblock append %}
{% if inline_errors and errors %}
<div class="{{ form_field_inline_error_classes }}">
<p class="form-message"><i class="fa fa-exclamation-circle"></i> {{ errors|first|raw }}</p>
</div>
{% endif %}
</div>
{% endblock %}
{% endblock %}
{% if field.description is defined %}
<div class="{{ form_field_extra_wrapper_classes }}">
<span class="form-description">
{{ form_field_description|raw }}
</span>
</div>
{% endif %}
</div>
{% endblock %}
</div>
{% endblock %}