{% extends 'forms/' ~ layout|default('field') ~ '.html.twig' %}

{% set value = (value is same as(false) ? 0 : value) %}

{% block input %}
    <div class="switch-toggle switch switch-{{ field.options|length }}">
    {% for key, text in field.options %}
        {% set id = "toggle_" ~ name ~ key %}
        <input type="radio"
               value="{{ key|e }}"
               id="{{ id|e }}"
               name="{{ (scope ~ name)|fieldName|e }}"
                {% if field.highlight is defined %}
                    class="{{ field.highlight == '' ~ key ? 'highlight' : '' }}"
                {% endif %}
                {% if '' ~ key == '' ~ value %}checked="checked" {% endif %}
                {% if field.validate.required in ['on', 'true', 1] %}required="required"{% endif %}
                />
        <label for="{{ id|e }}">{{ text|e }}</label>
        <a></a>
    {% endfor %}
    </div>
{% endblock %}
