16 const SUCCESS =
'success';
17 const ERROR =
'error';
18 const SESSION_KEY =
'_elgg_msgs';
38 $set = $this->loadRegisters();
41 foreach ($set as $prop => $values) {
42 if ($register_name === $prop || $register_name ===
'') {
43 if ($values || $register_name === $prop) {
44 $return[$prop] = $values;
52 if ($register_name && !isset($return[$register_name])) {
53 $return[$register_name] = [];
56 $this->saveRegisters($set);
67 public function count(
string $register_name =
''): int {
68 $set = $this->loadRegisters();
71 foreach ($set as $prop => $values) {
72 if ($register_name === $prop || $register_name ===
'') {
121 throw new InvalidArgumentException(__METHOD__ .
' $message needs to be an \ElggSystemMessage or an array of options');
124 $set = $this->loadRegisters();
126 $this->saveRegisters($set);
135 return $this->session->get(self::SESSION_KEY, []);
157 foreach ($set as $prop => $values) {
158 if (!is_array($values)) {
162 $arr = array_filter($values,
$filter);
164 $data[$prop] = array_values($arr);
168 $this->session->set(self::SESSION_KEY,
$data);
dumpRegister(string $register_name= '')
Empty and return the given register or all registers.
loadRegisters()
Load the registers from the session.
addSuccessMessage(string $message)
Display a system message on next page load.
Exception thrown if an argument is not of the expected type.
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
addMessage($message)
Adds a message to the registry.
if(!$entity instanceof\ElggUser) $data
count(string $register_name= '')
Counts the number of messages, either globally or in a particular register.
$filter
Layout content filter.
if(isset($_COOKIE['elggperm'])) $session
static factory(array $options)
Create an ElggSystemMessage from an associative array.
saveRegisters(array $set)
Save the registers to the session.
__construct(protected\ElggSession $session)
Constructor.
addErrorMessage(string $message)
Display an error on next page load.