kanellov / slim-twig-flash

Twig extension for rendering slim flash messages
GNU General Public License v3.0
22 stars 17 forks source link

Add has_message(...) Twig function #5

Open twovectors opened 7 years ago

twovectors commented 7 years ago

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.

kanellov commented 7 years ago

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 %}
koelle25 commented 4 years ago

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