File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 55 A common practice to better distinguish between templates and fragments is to
66 prefix fragments with an underscore. That's why this template is called
77 '_flash_messages.html.twig' instead of 'flash_messages.html.twig'
8+ #}
89
9- We check if we have session before reading flashes as it otherwise triggers session start:
10+ {#
11+ The request method check is needed to prevent starting the session when looking for "flash messages":
1012 https://symfony.com/doc/current/session/avoid_session_start.html
1113
1214 TIP: With FOSHttpCache you can also adapt this to make it cache safe:
1315 https://foshttpcachebundle.readthedocs.io/en/latest/features/helpers/flash-message.html
1416#}
15-
16- {% if app .request .hasPreviousSession %}
17+ {% if app .request .method == ' POST' %}
1718 <div class =" messages" >
1819 {% for type , messages in app .flashes %}
1920 {% for message in messages %}
You can’t perform that action at this time.
0 commit comments