PHP Class Elgg\SystemMessagesService

Use the elgg_* versions instead.
Since: 1.11.0
Mostra file Open project: elgg/elgg Class Usage Examples

Protected Properties

Property Type Description
$session ElggSession

Public Methods

Method Description
__construct ( ElggSession $session ) Constructor
addErrorMessage ( string | string[] $error ) : void Display an error on next page load.
addSuccessMessage ( string | string[] $message ) : void Display a system message on next page load.
count ( string $register_name = "" ) : integer Counts the number of messages, either globally or in a particular register
dumpRegister ( string $register_name = '' ) : array Empty and return the given register or all registers. In each case, the return value is a filtered version of the full registers array.
loadRegisters ( ) : RegisterSet Load the registers from the session
saveRegisters ( RegisterSet $set ) : void Save the registers to the session

Method Details

__construct() public method

Constructor
public __construct ( ElggSession $session )
$session ElggSession The Elgg session

addErrorMessage() public method

Display an error on next page load.
public addErrorMessage ( string | string[] $error ) : void
$error string | string[] Error or errors to add
return void

addSuccessMessage() public method

Display a system message on next page load.
public addSuccessMessage ( string | string[] $message ) : void
$message string | string[] Message or messages to add
return void

count() public method

Counts the number of messages, either globally or in a particular register
public count ( string $register_name = "" ) : integer
$register_name string Optionally, the register
return integer The number of messages

dumpRegister() public method

Empty and return the given register or all registers. In each case, the return value is a filtered version of the full registers array.
public dumpRegister ( string $register_name = '' ) : array
$register_name string The register. Empty string for all.
return array The array of registers dumped

loadRegisters() public method

Load the registers from the session
public loadRegisters ( ) : RegisterSet
return Elgg\SystemMessages\RegisterSet

saveRegisters() public method

The method of displaying these messages differs depending upon plugins and viewtypes. The core default viewtype retrieves messages in {@link 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.
public saveRegisters ( RegisterSet $set ) : void
$set Elgg\SystemMessages\RegisterSet The set of registers
return void

Property Details

$session protected_oe property

protected ElggSession $session
return ElggSession