{% block form %}
    <form action="{{ action }}" method="post" id="backend_favorite"{% if active %} data-turbo-stream="true"{% endif %}>
        <input type="hidden" name="REQUEST_TOKEN" value="{{ contao.request_token }}">
        {% if active %}
            <input type="hidden" name="FORM_SUBMIT" value="remove-favorite">
            <input type="hidden" name="target_path" value="{{ target_path }}">
            <button type="submit" class="icon-favorite" title="{{ 'MSC.unfavorite'|trans([], 'contao_default') }}" onclick="return confirm('{{ 'MSC.confirmUnfavorite'|trans([], 'contao_default')|e('js')|e('html') }}')">{{ backend_icon('favorite_active.svg') }}</button>
        {% else %}
            <button type="submit" class="icon-favorite" title="{{ 'MSC.favorite'|trans([], 'contao_default') }}">{{ backend_icon('favorite.svg') }}</button>
        {% endif %}
    </form>
{% endblock %}

{% block success_stream %}
    <turbo-stream action="replace" method="morph" target="backend_favorite">
        <template>
            {{ block('form') }}
        </template>
    </turbo-stream>

    <turbo-stream action="remove" target="favorites-menu{% if not empty %}-{{ id }}{% endif %}"></turbo-stream>
{% endblock %}
