Skip to content

Instantly share code, notes, and snippets.

@enricofoltran
Created April 3, 2013 14:16
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save enricofoltran/5301589 to your computer and use it in GitHub Desktop.
Save enricofoltran/5301589 to your computer and use it in GitHub Desktop.
Symfony: display all flash messages in a twig template
{% if app.session.flashbag.peekAll|length > 0 %}
{% for type, messages in app.session.flashbag.all %}
{% for message in messages %}
<div class="{{ type ? type : '' }}">
{{ message|trans({}, domain|default('messages')) }}
</div>
{% endfor %}
{% endfor %}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment