Open pawaclawczyk opened 10 years ago
Using get to retrieve flash messages now returns an array.
get
Before:
{% if app.session.hasFlash('notice') %} <div class="flash-notice"> {{ app.session.getFlash('notice') }} </div> {% endif %}
After:
{% for flashMessage in app.session.flashbag.get('notice') %} <div class="flash-notice"> {{ flashMessage }} </div> {% endfor %}
You can process all flash messages in a single loop with:
{% for type, flashMessages in app.session.flashbag.all() %} {% for flashMessage in flashMessages %} <div class="flash-{{ type }}"> {{ flashMessage }} </div> {% endfor %} {% endfor %}
Using
get
to retrieve flash messages now returns an array.Retrieving the flash messages from a Twig template
Before:
After:
You can process all flash messages in a single loop with: