Notification
in package
Provides user event notification functions
Table of Contents
Constants
- TYPE_CONFIRM : mixed = 1
- TYPE_ERROR : mixed = 2
- TYPE_INFO : mixed = 5
- TYPE_POPUP : mixed = 3
- TYPE_WARNING : mixed = 4
Properties
- $classes : mixed
Methods
- checkMessages() : string
- Renders notification messages for display to the user
- confirm() : void
- Adds a confirmation message to the list of messages that are shown to the user
- error() : void
- Adds an error message to the list of messages that are shown to the user
- has() : bool
- Checks to see if a notification of a particular type has been set
- info() : void
- Adds a information message to the list of messages that are shown to the user
- popup() : mixed
- Adds a popup message to the list of messages that are shown to the user
- retrieveMessages() : array<string|int, mixed>
- Return and then clear notifications in the session for a given scope
- warning() : void
- Adds a warning message to the list of messages that are shown to the user
Constants
TYPE_CONFIRM
public
mixed
TYPE_CONFIRM
= 1
TYPE_ERROR
public
mixed
TYPE_ERROR
= 2
TYPE_INFO
public
mixed
TYPE_INFO
= 5
TYPE_POPUP
public
mixed
TYPE_POPUP
= 3
TYPE_WARNING
public
mixed
TYPE_WARNING
= 4
Properties
$classes
public
static mixed
$classes
= array(self::TYPE_CONFIRM => 'confirm', self::TYPE_ERROR => 'error', self::TYPE_WARNING => 'neutral', self::TYPE_INFO => 'neutral neutral-grey')
Methods
checkMessages()
Renders notification messages for display to the user
public
static checkMessages([string $scope = 'default' ]) : string
Parameters
- $scope : string = 'default'
-
If set the the messages are pulled from a different session key
Return values
string —HTML
confirm()
Adds a confirmation message to the list of messages that are shown to the user
public
static confirm(string $message[, string $format = 'plain' ][, string $scope = 'default' ][, array<string|int, mixed> $actions = [] ]) : void
Parameters
- $message : string
-
The message to show
- $format : string = 'plain'
-
Either 'plain' for plain-text or 'html' for HTML which is limited to a safe subset
- $scope : string = 'default'
-
System to allow for multiple notification areas
- $actions : array<string|int, mixed> = []
-
An array of actions to be rendered as links
error()
Adds an error message to the list of messages that are shown to the user
public
static error(string $message[, string $format = 'plain' ][, string $scope = 'default' ][, array<string|int, mixed> $actions = [] ]) : void
Parameters
- $message : string
-
The message to show
- $format : string = 'plain'
-
Either 'plain' for plain-text or 'html' for HTML which is limited to a safe subset
- $scope : string = 'default'
-
System to allow for multiple notification areas
- $actions : array<string|int, mixed> = []
-
An array of actions to be rendered as links
has()
Checks to see if a notification of a particular type has been set
public
static has(int $type[, string $scope = 'default' ]) : bool
Parameters
- $type : int
-
One of the Notification::TYPE_* constants
- $scope : string = 'default'
-
System to allow for multiple notification areas
Return values
bool —True if a notification has been set
info()
Adds a information message to the list of messages that are shown to the user
public
static info(string $message[, string $format = 'plain' ][, string $scope = 'default' ][, array<string|int, mixed> $actions = [] ]) : void
Parameters
- $message : string
-
The message to show
- $format : string = 'plain'
-
Either 'plain' for plain-text or 'html' for HTML which is limited to a safe subset
- $scope : string = 'default'
-
System to allow for multiple notification areas
- $actions : array<string|int, mixed> = []
-
An array of actions to be rendered as links
popup()
Adds a popup message to the list of messages that are shown to the user
public
static popup(string $message[, array<string|int, mixed> $actions = [] ][, string $scope = 'default' ]) : mixed
Parameters
- $message : string
-
The message to show
- $actions : array<string|int, mixed> = []
-
Additional buttons to show with the message. In the format [ url => label ]
- $scope : string = 'default'
-
System to allow for multiple notification areas
retrieveMessages()
Return and then clear notifications in the session for a given scope
public
retrieveMessages([string $scope = 'default' ]) : array<string|int, mixed>
Parameters
- $scope : string = 'default'
Return values
array<string|int, mixed>warning()
Adds a warning message to the list of messages that are shown to the user
public
static warning(string $message[, string $format = 'plain' ][, string $scope = 'default' ][, array<string|int, mixed> $actions = [] ]) : void
Parameters
- $message : string
-
The message to show
- $format : string = 'plain'
-
Either 'plain' for plain-text or 'html' for HTML which is limited to a safe subset
- $scope : string = 'default'
-
System to allow for multiple notification areas
- $actions : array<string|int, mixed> = []
-
An array of actions to be rendered as links