Created
October 14, 2015 05:03
-
-
Save bahamut45/0acad131a8796ea8ccd5 to your computer and use it in GitHub Desktop.
Symfony Flash Message
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$this->get('session')->getFlashBag()->add( | |
'notice', | |
array( | |
'type' => 'info', | |
'class' => 'alert alert-info fade in', | |
'title' => 'Message flash :', | |
'dismissible' => 'alert-dismissible', | |
'buttonClose' => '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>', | |
'message' => 'La page de contact n\'est pas encore disponible, merci de revenir plus tard.' | |
) | |
); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for flashMessage in app.session.flashbag.get('notice') %} | |
<div class="{{ (flashMessage.dismissible is defined) ? flashMessage.class : 'alert' }} {{ (flashMessage.dismissible is defined) ? flashMessage.dismissible : '' }}" role="alert"> | |
{{ (flashMessage.buttonClose is defined) ? flashMessage.buttonClose|raw : '' }} | |
<strong>{{ flashMessage.title }}</strong> {{ flashMessage.message }} | |
</div> | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment