File tree 1 file changed +4
-3
lines changed 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 5
5
A common practice to better distinguish between templates and fragments is to
6
6
prefix fragments with an underscore. That's why this template is called
7
7
'_flash_messages.html.twig' instead of 'flash_messages.html.twig'
8
+ #}
8
9
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":
10
12
https://symfony.com/doc/current/session/avoid_session_start.html
11
13
12
14
TIP: With FOSHttpCache you can also adapt this to make it cache safe:
13
15
https://foshttpcachebundle.readthedocs.io/en/latest/features/helpers/flash-message.html
14
16
#}
15
-
16
- {% if app .request .hasPreviousSession %}
17
+ {% if app .request .method == ' POST' %}
17
18
<div class =" messages" >
18
19
{% for type , messages in app .flashes %}
19
20
{% for message in messages %}
You can’t perform that action at this time.
0 commit comments