Elgg
Version 6.1
|
System messages service. More...
Public Member Functions | |
__construct (protected\ElggSession $session) | |
Constructor. More... | |
dumpRegister (string $register_name= '') | |
Empty and return the given register or all registers. More... | |
count (string $register_name= '') | |
Counts the number of messages, either globally or in a particular register. More... | |
addSuccessMessage (string $message) | |
Display a system message on next page load. More... | |
addErrorMessage (string $message) | |
Display an error on next page load. More... | |
addMessage ($message) | |
Adds a message to the registry. More... | |
loadRegisters () | |
Load the registers from the session. More... | |
saveRegisters (array $set) | |
Save the registers to the session. More... | |
Public Attributes | |
const | SUCCESS = 'success' |
const | ERROR = 'error' |
const | SESSION_KEY = '_elgg_msgs' |
System messages service.
Use elgg()->system_messages
Definition at line 14 of file SystemMessagesService.php.
Elgg\SystemMessagesService::__construct | ( | protected\ElggSession | $session | ) |
Constructor.
\ElggSession | $session | The Elgg session |
Definition at line 25 of file SystemMessagesService.php.
Elgg\SystemMessagesService::addErrorMessage | ( | string | $message | ) |
Display an error on next page load.
string | $message | Error or errors to add |
Definition at line 98 of file SystemMessagesService.php.
Elgg\SystemMessagesService::addMessage | ( | $message | ) |
Adds a message to the registry.
\ElggSystemMessage | array | $message | Error or errors to add |
InvalidArgumentException |
Definition at line 115 of file SystemMessagesService.php.
Elgg\SystemMessagesService::addSuccessMessage | ( | string | $message | ) |
Display a system message on next page load.
string | $message | Message or messages to add |
Definition at line 87 of file SystemMessagesService.php.
Elgg\SystemMessagesService::count | ( | string | $register_name = '' | ) |
Counts the number of messages, either globally or in a particular register.
string | $register_name | Optionally, the register |
Definition at line 67 of file SystemMessagesService.php.
Elgg\SystemMessagesService::dumpRegister | ( | string | $register_name = '' | ) |
Empty and return the given register or all registers.
In each case, the return value is a filtered version of the full registers array.
string | $register_name | The register. Empty string for all. |
Definition at line 37 of file SystemMessagesService.php.
Elgg\SystemMessagesService::loadRegisters | ( | ) |
Load the registers from the session.
Definition at line 134 of file SystemMessagesService.php.
Elgg\SystemMessagesService::saveRegisters | ( | array | $set | ) |
Save the registers to the session.
The method of displaying these messages differs depending upon plugins and viewtypes. The core default viewtype retrieves messages in views/default/page/shells/default.php and displays messages as javascript popups.
Messages are stored as strings in the Elgg session as ['msg'][$register] array.
array | $set | The set of registers |
Definition at line 151 of file SystemMessagesService.php.
const Elgg\SystemMessagesService::ERROR = 'error' |
Definition at line 17 of file SystemMessagesService.php.
const Elgg\SystemMessagesService::SESSION_KEY = '_elgg_msgs' |
Definition at line 18 of file SystemMessagesService.php.
const Elgg\SystemMessagesService::SUCCESS = 'success' |
Definition at line 16 of file SystemMessagesService.php.