webseite-grav/themes/quark/templates/forms/fields/checkbox/checkbox.html.twig

33 lines
1.5 KiB
Twig

{% extends "forms/field.html.twig" %}
{% block label %}
{% endblock %}
{% block input %}
{% set id = field.id|default(field.name) ~ '-' ~ key %}
<div class="{{ form_field_wrapper_classes ?: 'form-input-wrapper' }} {{ field.size }} {{ field.wrapper_classes }}">
<label class="{{ form_field_checkbox_classes }}" for="{{ id|e }}">
<input
{# required attribute structures #}
name="{{ (scope ~ field.name)|fieldName }}"
value="{{ value|join(', ') }}"
type="checkbox"
{% if value == true %} checked="checked" {% endif %}
{# input attribute structures #}
{% block input_attributes %}
id="{{ id|e }}"
{% if field.classes is defined %}class="{{ field.classes }}" {% endif %}
{% if field.style is defined %}style="{{ field.style|e }}" {% endif %}
{% if field.disabled or isDisabledToggleable %}disabled="disabled"{% endif %}
{% if field.autofocus in ['on', 'true', 1] %}autofocus="autofocus"{% endif %}
{% if field.novalidate in ['on', 'true', 1] %}novalidate="novalidate"{% endif %}
{% if required %}required="required"{% endif %}
{% endblock %}
/>
<i class="form-icon"></i>
{{ field.label|t|e }} {{ field.validate.required in ['on', 'true', 1] ? '<span class="required">*</span>' }}
</label>
</div>
{% endblock %}