Download the PHP package ras/flash-alert-bundle without Composer
On this page you can find all versions of the php package ras/flash-alert-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ras/flash-alert-bundle
More information about ras/flash-alert-bundle
Files in ras/flash-alert-bundle
Package flash-alert-bundle
Short Description FlashAlertBundle provides a simplified way to handle (add/display) Symfony flash messages. Client side scripts are written in pure JavaScript.
License MIT
Homepage http://rasanga.github.io/FlashAlertBundle/
Informations about the package flash-alert-bundle
FlashAlertBundle
FlashAlertBundle is an open source Bundle which simplifies displaying flash alerts such as success, error, info and warning
Table of Contents
- Installation
- Download the FlashAlertBundle
- Enable the bundle
- Configure the bundle
- Usage
- Report flash alerts
- Display flash alerts
- Configuration
- Override view template
- Add custom styles
- Changelog
- License
Installation
Step 1: Download the FlashAlertBundle
Using Composer
Add the following to the "require" section of your composer.json
file:
And update your dependencies
Using submodules Execute the following command on your project root:
Step 2: Enable the bundle
Registers the bundle in your app/AppKernel.php
:
Step Optional, if you are not using composer: Configure the Autoloader
Add the following to your autoload.php
:
Usage
Report flash alerts
Add the following PHP code to report an alert message:
Note: You can choose one of the following functions to call from
$this->get('ras_flash_alert.alert_reporter')
Display flash alerts
Add the following twig code where you want to display alert messages:
Note 1: The parent twig template would be the best place for displaying flash alerts
Configuration
The following parameters can be overriden in your config.yml
or similar:
These can also be passed as parameters in the view when rendering alerts - for example:
Override view template
- Create template in the
/Resources/views/
or in your bundle - Retrieve alerts into your template with
{{ get_alert_publisher() }}
- Include template blocks in
FlashAlertBundle/Resources/views/FlashAlert
directory or define your own blocks (followFlashAlertBundle/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.
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
CHANGELOG
2.0
Add twig method for rendering alerts: `{{ render_flash_alerts() }}`
Add twig method for retrieving alerts: `{{ get_alert_publisher() }}`
Deprecated controller view render
LICENSE
FlashAlertBundle is licensed under the MIT Open Source license.