{% block flashes %}
    {# Insert flashes #}
    <turbo-stream action="update" action="morph" target="toast-container">
        <template>
            {% for label, messages in app.flashes() %}
                {% for message in messages %}
                    {{ include('_toast.html.twig', {
                        'label': label,
                        'message': message
                    }) }}
                {% endfor %}
            {% endfor %}
        </template>
    </turbo-stream>
{% endblock %}

{# Insert info about when the sidebar trees were updated last time, so the sidebar_tree_controller can decide if it needs to reload the tree #}
<span id="sidebar-last-time-updated" style="display: none;" data-last-update="{{ sidebar_tree_updater.lastTreeUpdate.format("Y-m-d\\TH:i:sP") }}"></span>

<turbo-stream action="update" target="locale-select-menu">
    <template>
        {% set locales = settings_instance('localization').languageMenuEntries %}
        {% if locales is empty %}
            {% set locales = locale_menu %}
        {% endif %}

        {% for locale in locales %}
            <a class="dropdown-item" data-turbo="false" data-turbo-frame="_top" href="{{ path(app.request.attributes.get('_route'),
                app.request.query.all|merge(app.request.attributes.get('_route_params'))|merge({'_locale': locale})) }}">
                {{ locale|language_name }} ({{ locale|upper }})</a>
        {% endfor %}
    </template>
</turbo-stream>


