pfeifferNet

Messages
in package

Provide messages for frontend display.

Tags
since
1.0.0
since
5.5.0

Refactor for simplification. Uses array rather than switch cases.

since
5.11.0

Deprecated global singleton.

since
6.0.0

Add banner and snackbar support functionality.

used-by
Login::__construct()
used-by
Form
used-by
Form::__construct()
used-by
User_Notifications::__construct()

Table of Contents

Constants

BANNER_CONTAINER  = 'banner.php'
Banner container partial.
SNACKBAR_CONTAINER  = 'snackbar.php'
Snackbar container partial.

Properties

$banner_container  : string
The fully qualified path to the banner container partial.
$helper  : Content
The instance of the helper class.
$icons  : Icons
The instance of the SVG icon handler.
$instances  : array<string|int, object>
The array of instances of this class and sub-classes.
$snackbar_container  : string
The fully qualified path to the snackbar container partial.

Methods

get_banner()  : string
Return a rendered banner message.
get_instance()  : object
Creates and/or returns the instance of this class.
get_message()  : string
Finds and returns the message text for the given code.
get_snackbar()  : string
Return a rendered snackbar message.
__construct()  : void
Initialise the class.
get_message_class()  : string
Returns the message class for the given level.

Constants

BANNER_CONTAINER

Banner container partial.

protected string BANNER_CONTAINER = 'banner.php'
Tags
since
6.0.0

SNACKBAR_CONTAINER

Snackbar container partial.

protected string SNACKBAR_CONTAINER = 'snackbar.php'
Tags
since
6.0.0

Properties

$banner_container

The fully qualified path to the banner container partial.

protected string $banner_container = ''
Tags
since
6.0.0

$helper

The instance of the helper class.

protected Content $helper
Tags
since
6.0.0

$instances

The array of instances of this class and sub-classes.

protected static array<string|int, object> $instances = array()
Tags
since
5.11.0

$snackbar_container

The fully qualified path to the snackbar container partial.

protected string $snackbar_container = ''
Tags
since
5.8.0

Methods

get_banner()

Return a rendered banner message.

public get_banner(string $code[, string $level = 'info' ][, string $redirect = '' ][, array<string|int, string> $buttons = array() ]) : string
Parameters
$code : string

The message to retrieve and render.

$level : string = 'info'

Optional. The level of notification to generate. Defaults to info.

$redirect : string = ''

Optional. A URL to redirect to when the banner is closed. Default is empty.

$buttons : array<string|int, string> = array()

Optional. An array of additional buttons on banner. Default is empty. @type string $url The fully qualified URL for the button link. @type string $text The text for the button. @type string $title The title attribute for the button.

Tags
since
6.0.0
uses
Helper::strip_whitespace()
uses
Icons::get_icon()
see
Messages::get_message_class()
used-by
Form::render_success_notification()
used-by
Form_User_Account::do_intercepts()
used-by
User_Notifications::get_notifications()
used-by
Register_Form::the_content()
Return values
string

The rendered banner, or empty if code is invalid.

get_instance()

Creates and/or returns the instance of this class.

public static get_instance() : object
Tags
since
5.11.0
Return values
object

The instance of this class.

get_snackbar()

Return a rendered snackbar message.

public get_snackbar(string $code[, string $level = 'info' ]) : string
Parameters
$code : string

The message to retrieve and render.

$level : string = 'info'

Optional. The level of notification to generate. Defaults to info.

Tags
since
6.0.0
uses
Helper::strip_whitespace()
uses
Icons::get_icon()
see
Messages::get_message_class()
used-by
Form::render()
Return values
string

The rendered snackbar, or empty if code invalid.

get_message_class()

Returns the message class for the given level.

protected get_message_class([string $level = 'info' ]) : string
Parameters
$level : string = 'info'

Optional. The level of notification to generate. Defaults to info.

Tags
since
6.0.0
Return values
string

The message class.


        
On this page

Search results