Skip to content

Commit b8723e6

Browse files
HaehnchenXWB
authored andcommitted
Add missing hasPreviousSession condition check in layout.html.twig example
Documentation for `/Resources/views/layout.html.twig` is out of sync with real file content, this adds hasPreviousSession check
1 parent 730a8a5 commit b8723e6

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Resources/doc/overriding_templates.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@ Here is the default ``layout.html.twig`` provided by the FOSUserBundle:
3535
{% endif %}
3636
</div>
3737
38-
{% for type, messages in app.session.flashBag.all %}
39-
{% for message in messages %}
40-
<div class="{{ type }}">
41-
{{ message|trans({}, 'FOSUserBundle') }}
42-
</div>
38+
{% if app.request.hasPreviousSession %}
39+
{% for type, messages in app.session.flashBag.all %}
40+
{% for message in messages %}
41+
<div class="{{ type }}">
42+
{{ message|trans({}, 'FOSUserBundle') }}
43+
</div>
44+
{% endfor %}
4345
{% endfor %}
44-
{% endfor %}
46+
{% endif %}
4547

4648
<div>
4749
{% block fos_user_content %}

0 commit comments

Comments
 (0)