{% if prefs_filter is defined and prefs_filter|length %} {% with messages = get_flashed_messages(with_categories=True, category_filter=prefs_filter) %} {% for category, message in messages %} {# Get the end of the of the category message which contains the category status.(success/error/notification)#} {% set category_status = category.split('-')|last %} {% endfor %} {% endwith %} {% endif %}