slim-twig-flash icon indicating copy to clipboard operation
slim-twig-flash copied to clipboard

Add has_message(...) Twig function

Open twovectors opened this issue 7 years ago • 2 comments

Adds a has_message('key') twig function that exposes the base Flash hasMessage() function to test if a key has messages. Useful for selectively displaying template elements, like error divs.

twovectors avatar Apr 14 '17 08:04 twovectors

Hi @twovectors, I've examined your pr. When I have some time I' ll merge it.

FYI I' m currently using

{% if not flash() is empty %}
    {# render all messages #}
{% endif %}

{% if not flash('danger') is empty %}
    {# render errors #}
{% endif %}

kanellov avatar May 11 '17 21:05 kanellov

Hey @kanellov , could you merge this? It's been long over 2 years since this PR was opened.

koelle25 avatar Jan 16 '20 15:01 koelle25