Configuration - Rasanga/FlashAlertBundle GitHub Wiki

The following parameters can be overriden in your config.yml or similar:

ras_flash_alert:
    template: '::flashAlerts.html.twig'     # defaults to 'RasFlashAlertBundle::layout.html.twig'
    isAddStyles: false                      # defaults to true
    isAddJsAlertClose: false                # defaults to true

These can also be passed as parameters in the view when rendering alerts - for example:

    {{ render_flash_alerts({ 'template': '::flashAlerts.html.twig', 'isAddStyles': false }) }}

Override view template

  1. Crete template in the /Resources/views/ or in your bundle
  2. Retrieve alerts into your template with {{ get_alert_publisher() }}
  3. Include template blocks in FlashAlertBundle/Resources/views/FlashAlert directory or define your own blocks (follow FlashAlertBundle/Resources/views/FlashAlert/flashAlerts.html.twig to see how you can define your own template)

Add custom styles

The bundle default template has styles defined by default. However, you can turn off default styles by configuring isAddStyles variable to false as shown in below.

    {{ render_flash_alerts({ 'isAddStyles': false }) }}

Then you can define your own styles to match alert classes such as alert, alert-close, alert-success, alert-error, alert-warning and alert-info