A JS based flash messenger for Silverstripe
This is a bit special to use, to add area specific pages you have to prepend your calls with the area you would like to add it to. For example:
singleton('message')->cms()->add('Yay! My pretty messages');
If you want to add more, you can chain but you always must prepend the area.
singleton('message')->cms()->info('Yay! My pretty messages')->cms()->error('A bad message');
singleton('message')->add($content, $level, $timeout, $priority, $dismissable, $area)
singleton('message')->add($params)
singleton('message')->cms()->note('grrr...')
singleton('message')->remove($content, $level, $area)
singleton('message')->remove($params)
singleton('message')->before($link)
singleton('message')->style($area)
Areas are mapped to controllers. The following areas are available:
By default the cms area is used. Any other value will add a message to any controller. So you can use ->global() to add a global message.
Once a notification is dismissed, it will not be shown for the current session. To disable this, you must inject the NullBlocker into the Notifier class, as below:
Injector:
message:
constructor:
BlocksNotifications: '%$Milkyway\SS\FlashMessage\NullBlocker'
You can create your own implementation, but you must implement the Milkyway\SS\FlashMessage\Contracts\BlocksNotifications
interface and inject it as above. An example would be a Cookie blocker, or a class that blocks based on area.
This messaging system is javascript based. It should work on most controllers as long as it accesses Silverstripe requirements.
Add the following to your composer.json file
"require" : {
"milkyway-multimedia/ss-mwm-flashmessage": "dev-master"
}
Module rating system helping users find modules that are well supported. For more on how the rating system works visit Module standards
Score not correct? Let us know there is a problem