-
Notifications
You must be signed in to change notification settings - Fork 1
Retrieving messages
Messages of any type can be retrieved by prepending get
to the type. For example:
Feedback::getError();
Feedback::getSuccess();
Feedback::getFoo();
To retrieve all messages regardless of type, simply call
Feedback::get();
##Retrieving namespaced messages##
Namespaced messages can be retrieved by passing the namespace string as the first parameter:
Feedback::getError('user');
Conversely, if you want to retrieve all messages of a type that are not in a given namespace, preface the namespace with "!":
Feedback::getError('!user');
To retrieve all messages in a namespace, regardless of type, simply call
Feedback::get('yournamespace');
Let's say you've created the following messages:
Feedback::error('Basic error');
Feedback::error('user','User error');
Feedback::success('Basic success');
Feedback::success('user','User success');
Then,
Feedback::getError()
Would return the messages "Basic error","User error"
Feedback::getError('user')
Would return the message "User error"
Feedback::get('.user');
Would return the messages "User error","User success". Note the selector starts with a period - which indicates a namespace. If that period wasn't there, this method call would return all messages of type 'user' (there are none in this example)