{% extends '@Contao/block_unsearchable.html.twig' %}

{% block content %}

    <form id="{{ formId }}" method="post">
        <div class="formbody">
            <input type="hidden" name="FORM_SUBMIT" value="{{ formId }}">
            <input type="hidden" name="REQUEST_TOKEN" value="{{ contao.request_token }}">

            {% if message|default %}
                <p class="{{ mclass }}">{{ message }}</p>
            {% endif %}

            {% if not showChannels %}
                {% for id, title in channels %}
                    <input type="hidden" name="channels[]" value="{{ id }}">
                {% endfor %}
            {% endif %}

            <div class="widget widget-text mandatory">
                <label for="ctrl_email_{{ id }}" class="invisible">{{ emailLabel }}</label>
                <input type="email" name="email" id="ctrl_email_{{ id }}" class="text mandatory" value="{{ email }}" placeholder="{{ emailLabel }}" required>
            </div>

            {% if showChannels %}
                <div class="widget widget-checkbox">
                    <fieldset id="ctrl_channels_{{ id }}" class="checkbox_container">
                        <legend class="invisible">{{ channelsLabel }}</legend>
                        {% for id, title in channels %}
                            <span><input type="checkbox" name="channels[]" id="opt_{{ id }}_{{ id }}" value="{{ id }}" class="checkbox"{% if id in selectedChannels|default([]) %} checked{% endif %}> <label for="opt_{{ id }}_{{ id }}">{{ title }}</label></span>
                        {% endfor %}
                    </fieldset>
                </div>
            {% endif %}

            {{ captcha|raw }}

            {% if text|default %}
                <div class="widget widget-explanation">
                    {{ text|sanitize_html('contao')|csp_inline_styles|insert_tag_raw }}
                </div>
            {% endif %}

            <div class="widget widget-submit">
                <button type="submit" class="submit">{{ submit }}</button>
            </div>
        </div>
    </form>

{% endblock %}
