PHP Classes

File: templates/default/_flash_messages.html.twig

Recommend this page to a friend!
  Classes of Manolo Salsas  >  Symfony Create Bundle Skeleton  >  templates/default/_flash_messages.html.twig  >  Download  
File: templates/default/_flash_messages.html.twig
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Symfony Create Bundle Skeleton
Application to create reusable Symfony Bundles
Author: By
Last change:
Date: 2 years ago
Size: 1,403 bytes


Class file image Download
   This is a template fragment designed to be included in other templates

   A common practice to better distinguish between templates and fragments is to
   prefix fragments with an underscore. That's why this template is called
   '_flash_messages.html.twig' instead of 'flash_messages.html.twig'

   The check is needed to prevent starting the session when looking for "flash messages":

   TIP: With FOSHttpCache you can also adapt this to make it cache safe:
{% if app.request.hasPreviousSession %}
    <div class="messages">
        {% for type, messages in app.flashes %}
            {% for message in messages %}
                {# Bootstrap alert, see #}
                <div class="alert alert-dismissible alert-{{ type }} fade in" role="alert">
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        <span aria-hidden="true">&times;</span>

                    {{ message|trans }}
            {% endfor %}
        {% endfor %}
{% endif %}
For more information send a message to info at phpclasses dot org.