Question

I have been wondering if there is a standard way of doing session based messages in Silverstripe.

For example a module could set a message like The task has been processed and then redirect to another page, and the message would be displayed in a small box on that page.

For example Django framework has http://docs.djangoproject.com/en/dev/ref/contrib/messages/ Drupal has http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/drupal_set_message

I have googled this and found no modules or built in functionality to dot this. It would be good if all apps, even external ones would handle messaging in the same way. Is this just something that is missing in Silverstripe?

Was it helpful?

Solution

You could do this using Session::addToArray($key, $value) (http://api.silverstripe.org/2.4/sapphire/control/Session.html#methodaddToArray). Then Session::get($key) to retrieve the value.

OTHER TIPS

I've made a patch to implement this feature, as it really should be in core.

See http://open.silverstripe.org/ticket/6633

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top