2017 © Pedro Peláez
 

silverstripe-module ss-mwm-flashmessage

A JS based flash messenger for Silverstripe

image

milkyway-multimedia/ss-mwm-flashmessage

A JS based flash messenger for Silverstripe

  • Friday, July 8, 2016
  • by mi3ll
  • Repository
  • 1 Watchers
  • 2 Stars
  • 343 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 4 % Grown

The README.md

Milkyway Multimedia - Silverstripe Core Extensions

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');
  • Add a global message singleton('message')->add($content, $level, $timeout, $priority, $dismissable, $area)
  • Add a global message by array (you can add an id if you use this method) singleton('message')->add($params)
  • Growl example singleton('message')->cms()->note('grrr...')
  • Remove a global message singleton('message')->remove($content, $level, $area)
  • Remove a global message by array (you can remove by id if you use this method) singleton('message')->remove($params)
  • Add a link to call before displaying notifications (for calls to APIs) singleton('message')->before($link)
  • Force load CSS & JS for certain area (for API based messages) singleton('message')->style($area)

Available areas

Areas are mapped to controllers. The following areas are available:, (*3)

  • cms: Will add a global message to the CMS
  • page: Will add a global message to any Page
  • form: Will add a global message during a form request
  • global: Add a global message

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)

Available levels

  • info
  • success
  • error
  • warning
  • modal: Show a message modal, this will attempt to either use a bootstrap modal, jquery ui modal, vex alert or javascript alert (ordered by priority)
  • note: Show a growl notification, this will attempt to either use a Messenger, vex alert, CMS notification or javascript alert (ordered by priority)

Blockers

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)

How it works

This messaging system is javascript based. It should work on most controllers as long as it accesses Silverstripe requirements., (*7)

Install

Add the following to your composer.json file, (*8)


"require" : { "milkyway-multimedia/ss-mwm-flashmessage": "dev-master" }

License

  • MIT

Version

  • Version 0.1 (Alpha)

Contact

Mellisa Hankins

  • E-mail: mellisa.hankins@me.com
  • Twitter: @mi3ll
  • Website: mellimade.com.au

The Versions

08/07 2016

dev-master

9999999-dev

A JS based flash messenger for Silverstripe

  Sources   Download

MIT

The Requires

 

by Mellisa Hankins

silverstripe message flash mwm