templates/_flash.html.twig line 1

Open in your IDE?
  1. {# The container to show the flash messages #}
  2. <div class="toast-container" id="message-container" style="min-width: 20%;">
  3.     {% for label, messages in app.flashes() %}
  4.         {% for message in messages %}
  5.             {% set flash_title = label|replace({'success': 'flash.success', 'error': 'flash.error'
  6.                 , 'warning': 'flash.warning', 'notice': 'flash.notice', 'info': 'flash.info'}) %}
  7.             {% set flash_symbol = label|replace({'success': 'fa-check-circle', 'error': 'fa-exclamation-triangle'
  8.                 , 'warning': 'fa-exclamation-circle', 'notice': 'fa-flag', 'info': 'fa-flag'}) %}
  9.             {% set flash_bg = label|replace({'success': 'bg-success text-white',
  10.                 'error': 'bg-danger text-white', 'warning': 'bg-warning text-white',
  11.                 'notice': 'bg-info text-white', 'info': 'bg-light'})%}
  12.             <div class="toast shadow" role="alert" aria-live="assertive" aria-atomic="true" data-delay="5000">
  13.                 <div class="toast-header {{ flash_bg }}">
  14.                     {# <img src="..." class="rounded mr-2" alt="...">#}
  15.                     <i class="fas fa-fw {{ flash_symbol }} mr-2"></i>
  16.                     <strong class="mr-auto">{{ flash_title|trans }}</strong>
  17.                     <small class="text-muted">{{ "now" | format_datetime("short", "short") }}</small>
  18.                     <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
  19.                         <span aria-hidden="true">&times;</span>
  20.                     </button>
  21.                 </div>
  22.                 <div class="toast-body {{ flash_bg }}">
  23.                     {{ message | trans}}
  24.                 </div>
  25.             </div>
  26.         {% endfor %}
  27.     {% endfor %}
  28. </div>