47 lines
2.1 KiB
Twig
47 lines
2.1 KiB
Twig
|
{% extends "forms/field.html.twig" %}
|
||
|
|
||
|
{% block label %}
|
||
|
{% endblock %}
|
||
|
|
||
|
{% block input %}
|
||
|
{% set id = field.id|default(field.name)|hyphenize %}
|
||
|
<div class="{{ form_field_wrapper_classes ?: 'form-input-wrapper' }} {{ field.size }} {{ field.wrapper_classes }}">
|
||
|
<input
|
||
|
{# required attribute structures #}
|
||
|
name="{{ (scope ~ field.name)|fieldName }}"
|
||
|
value="{{ field.value ?? '1' }}"
|
||
|
type="checkbox"
|
||
|
{% if value == (field.value ?? '1') %} checked="checked" {% endif %}
|
||
|
|
||
|
{# input attribute structures #}
|
||
|
{% block input_attributes %}
|
||
|
id="{{ id|e }}"
|
||
|
class="{{ form_field_checkbox_classes }} {{ field.classes }}"
|
||
|
{% 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 %}
|
||
|
{% if field.tabindex %}tabindex="{{ field.tabindex }}"{% endif %}
|
||
|
{% if field.attributes is defined %}
|
||
|
{% for key,attribute in field.attributes %}
|
||
|
{% if attribute|of_type('array') %}
|
||
|
{{ attribute.name }}="{{ attribute.value|e('html_attr') }}"
|
||
|
{% else %}
|
||
|
{{ key }}="{{ attribute|e('html_attr') }}"
|
||
|
{% endif %}
|
||
|
{% endfor %}
|
||
|
{% endif %}
|
||
|
{% endblock %}
|
||
|
/>
|
||
|
<label style="display:inline;" class="inline" for="{{ id|e }}">
|
||
|
{% if field.markdown %}
|
||
|
{{ field.label|t|markdown(false) }}
|
||
|
{% else %}
|
||
|
{{ field.label|t|e }}
|
||
|
{% endif %}
|
||
|
{{ field.validate.required in ['on', 'true', 1] ? '<span class="required">*</span>' }}
|
||
|
</label>
|
||
|
</div>
|
||
|
{% endblock %}
|