Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
core\notification Class Reference

Static Public Member Functions

static add ($message, $level=null)
 Add a message to the session notification stack.
 
static add_call_to_action (array $icon, string $message, array $actions, string $region='')
 
static error ($message)
 Add a error message to the notification stack.
 
static fetch ()
 Fetch all of the notifications in the stack and clear the stack.
 
static fetch_as_array (\renderer_base $renderer)
 Fetch all of the notifications in the stack and clear the stack.
 
static info ($message)
 Add a info message to the notification stack.
 
static success ($message)
 Add a success message to the notification stack.
 
static warning ($message)
 Add a warning message to the notification stack.
 

Public Attributes

const ERROR = 'error'
 A notification of level 'error'.
 
const INFO = 'info'
 A notification of level 'info'.
 
const SUCCESS = 'success'
 A notification of level 'success'.
 
const WARNING = 'warning'
 A notification of level 'warning'.
 

Member Function Documentation

◆ add()

static core\notification::add ( $message,
$level = null )
static

Add a message to the session notification stack.

Parameters
string$messageThe message to add to the stack
string$levelThe type of message to add to the stack

◆ add_call_to_action()

static core\notification::add_call_to_action ( array $icon,
string $message,
array $actions,
string $region = '' )
static
Parameters
string[]$iconThe icon to use. Required keys are 'pix' and 'component'.
string$messageThe message to display.
array$actionsAn array of action links
string$regionOptional region name
Exceptions
coding_exception

◆ error()

static core\notification::error ( $message)
static

Add a error message to the notification stack.

Parameters
string$messageThe message to add to the stack

◆ fetch()

static core\notification::fetch ( )
static

Fetch all of the notifications in the stack and clear the stack.

Return values
core\output\notification[]All of the notifications in the stack

◆ fetch_as_array()

static core\notification::fetch_as_array ( \renderer_base $renderer)
static

Fetch all of the notifications in the stack and clear the stack.

Return values
arrayAll of the notifications in the stack

◆ info()

static core\notification::info ( $message)
static

Add a info message to the notification stack.

Parameters
string$messageThe message to add to the stack

◆ success()

static core\notification::success ( $message)
static

Add a success message to the notification stack.

Parameters
string$messageThe message to add to the stack

◆ warning()

static core\notification::warning ( $message)
static

Add a warning message to the notification stack.

Parameters
string$messageThe message to add to the stack

The documentation for this class was generated from the following file: