cheddam/silverstripe-flash-messages

A simple module for sending flash messages in your SilverStripe app.

Installs: 510

Dependents: 0

Suggesters: 0

Stars: 3

Watchers: 1

Forks: 5

Open Issues: 1

Type:silverstripe-vendormodule

v1.0.0 2018-06-08 06:10 UTC

README

for flashing dem messages

For SilverStripe 3 compatibility, use v1.0.0.

Usage

composer require cheddam/silverstripe-flash-messages

In controller methods:

$this->flashMessage('She drove me here', 'warning');

In templates:

<% if $FlashMessagesPresent %>
	<% loop $FlashMessages %>
		<div class="message message--$Type">$Message</div>
	<% end_loop %>
<% end_if %>

Caveats

  • $FlashMessages can only be called once as it clears the messages from the session before returning them.