dev-master
9999999-devA JS based flash messenger for Silverstripe
MIT
The Requires
by Mellisa Hankins
silverstripe message flash mwm
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:, (*1)
singleton('message')->cms()->add('Yay! My pretty messages');
If you want to add more, you can chain but you always must prepend the area., (*2)
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:, (*3)
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., (*4)
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:, (*5)
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., (*6)
This messaging system is javascript based. It should work on most controllers as long as it accesses Silverstripe requirements., (*7)
Add the following to your composer.json file, (*8)
"require" : { "milkyway-multimedia/ss-mwm-flashmessage": "dev-master" }
A JS based flash messenger for Silverstripe
MIT
silverstripe message flash mwm