{% if config.DEBUG %}<span class="debug-hint" title="{{ self._TemplateReference__context.name }}">?</span>{% endif %}

<div class="field {{ content.__class__.__name__.lower() }}">

{% if content.multi %}

    {% if content.label %}<legend>{{ content.label }}</legend>{% endif %}
    {% for choice, label in content.choices %}
        <input
            id="{{ content.ref_id }}-{{ choice }}"
            class="{{ content.ref_id }} {{ content.prefix }}-{{ content.name }}{% if content.errors %} invalid{% endif %}"
            type="checkbox"
            name="{{content.prefix}}.{{ content.name }}"
            {% if content.readonly %}readonly{% endif %}

            {% if content.form %}
                form="{{ content.form.ref_id }}"
            {% endif %}

            value="{{ content.value_string(choice) }}"

            {% if content.checked(choice) %}checked{% endif %}

            {% if content.required %}
            required
            {% endif %}
        >
        <label for="{{ content.ref_id }}-{{ choice }}">{% if label %}<span class="caption">{{ label }}</span>{% endif %}</label>
    {% endfor %}

{% else %}


    <input
        id="{{ content.ref_id }}"
        class="{{ content.prefix }}-{{ content.name }}{% if content.errors %} invalid{% endif %}"
        type="checkbox"
        name="{{content.prefix}}.{{ content.name }}"
        {% if content.readonly %}readonly{% endif %}

        {% if content.form %}
            form="{{ content.form.ref_id }}"
        {% endif %}

        value="{{ content.value_string(content.value) }}"

        {% if content.checked(content.value) %}checked{% endif %}

        {% if content.required %}
        required
        {% endif %}
    >

    <label for="{{ content.ref_id }}">{% if content.label %}<span class="caption">{{ content.label }}</span>{% endif %}</label>

{% endif %}

    {% if self.help()|trim %}
    {% block help %}
        {% if content.help_text %}
           <span class="help">{{ content.help_text }}</span> 
        {% endif %}
    {% endblock %}
    {% endif %}

</div>
