Usage - Rasanga/FlashAlertBundle GitHub Wiki

Report flash alerts

Add the following PHP code to report an alert message:

    $this->get('ras_flash_alert.alert_reporter')->addError("Access denied");

Note: You can choose one of the following functions to call from $this->get('ras_flash_alert.alert_reporter')

    addSuccess()
    addError()
    addWarning()
    addInfo()

Display flash alerts

Add the following twig code where you want to display alert messages:

    {{ render_flash_alerts() }}

Note 1: The parent twig template would be the best place for displaying flash alerts