Easy flash messages for Silverstripe

Installs: 1 348

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 4

Open Issues: 1


1 2018-12-08 07:55 UTC

This package is not auto-updated.

Last update: 2024-05-14 02:45:12 UTC


Scrutinizer Packagist Packagist

Display simple one-time flash message with Twitter Bootstrap or Zurb Foundation markup.

    public function submitForm($data, Form $form)
        Flash::success('Form saved');
        return $this->controller->redirect($this->controller->Link());


$ composer require axyr/silverstripe-flashmessage

Add the template variable $FlashMessage to your Page template where you wish the flash dialog to appear.


The FlashMessage template has all the markup and attributes so that it will play nicely with the Twitter Bootstrap and Zurb Foundation frameworks.

You can set a colored flash message with te following methods:

Flash::info('Some message');
Flash::success('Some message');
Flash::warning('Some message');
Flash::danger('Some message'); // Bootstrap
Flash::alert('Some message'); // Foundation

By default the message will be closable, but this can be disabled. You can also set the message to automaticly fadeout.

For this to work, we assume jQuery is used and the flashmessage.js file is added to the Requirements::javascript();

Flash::success('You cannot close me', false);
Flash::success('I will fade out', false, true);

You can also show the message in a modal window :

Flash::modal('Some message');


     Type: success
     Closable: true
     FadeOut: false
     - info
     - success
     - warning
     - danger
     - alert
     - modal
   template: FlashMessage
   session_name: FlashMessage
   load_javascript: true