{% set style = saveprefsbutton.style|default('display:inline-block;text-decoration:none;border-color:#4e5d9d;border-width: 10px 20px;border-style:solid; text-decoration: none; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; background-color: #4e5d9d; display: inline-block;font-size: 16px; color: #ffffff;') %}
{% set background = saveprefsbutton.background|default('') %}

{% if form is defined %}
    {% do form.lead_channels.subscribed_channels.setRendered() %}
    {% do form.buttons.save.setRendered() %}
    {% do form.buttons.cancel.setRendered() %}
    {# add form tag #}
    <script src="{{ getAssetUrl('app/bundles/PageBundle/Assets/js/prefcenter.js') }}"></script>

    {# add close form tag before the custom tag to prevent cascading forms #}
    {# in case there is already an unsubscribe form on the page #}
    {# that's why we can't use the bodyclose customdeclaration #}
    {% if (custom_tag is defined and custom_tag is not empty) %}
        {{ custom_tag|raw }}
        {{ assetAddCustomDeclaration(form_rest(form), 'customTag') }}
    {% else %}
        {{ assetAddCustomDeclaration(form_rest(form), 'bodyClose') }}
    {% endif %}
{% endif %}

    <a href="javascript:void(null)"
        class="button btn btn-ghost btn-save"
        {% if form is defined %}onclick="saveUnsubscribePreferences('{{ form.vars.id }}')"{% endif %}
        style="{{ style }}"
        background="{{ background }}">
        {{ 'mautic.page.form.saveprefs'|trans }}
    </a>
    <div style="clear:both"></div>
