{% 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 }}"
               id="{{ id }}"
               name="{{ (scope ~ name)|fieldName }}"
                {% 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 }}">{{ text }}</label>
        <a></a>
    {% endfor %}
    </div>
{% endblock %}
