{# Display all the flashes messages #} {% macro flashes() %} {% for type, flashes in app.session.flashBag.all %}
{% endfor %} {% endmacro %} {# Display a bootstrap alert : - text : Message to print (string or array) - type : danger | warning | success | info (Default : info) #} {% macro alert(text, type) %} {% set type = 'alert-' ~ type|default('info') %} {% if text|default %}
{% if text is iterable %} {% else %} {{ text|trans }} {% endif %}
{% endif %} {% endmacro %} {% macro danger(text) %} {% from _self import alert %} {{ alert(text, 'danger') }} {% endmacro %} {% macro error(text) %} {% from _self import danger %} {{ danger(text) }} {% endmacro %} {% macro warning(text) %} {% from _self import alert %} {{ alert(text, 'warning') }} {% endmacro %} {% macro success(text) %} {% from _self import alert %} {{ alert(text, 'success') }} {% endmacro %} {% macro info(text) %} {% from _self import alert %} {{ alert(text, 'info') }} {% endmacro %}