\WPTRT\AdminNoticesNotice

The Admin_Notice class, responsible for creating admin notices.

Each notice is a new instance of the object.

Summary

Methods
Properties
Constants
__construct()
the_notice()
show()
get_classes()
get_title()
get_message()
$dismiss
No constants found
No protected methods found
No protected properties found
N/A
is_screen()
$id
$message
$options
$allowed_html
$allowed_types
N/A

Properties

$dismiss

$dismiss :\WPTRT\AdminNotices\Dismiss

An instance of the \WPTRT\AdminNotices\Dismiss object.

Type

\WPTRT\AdminNotices\Dismiss

$id

$id :string

The notice-ID.

Type

string

$message

$message :string

The notice message.

Type

string

$options

$options :array

The notice arguments.

Type

array

$allowed_html

$allowed_html :array

Allowed HTML in the message.

Type

array

$allowed_types

$allowed_types :array

An array of allowed types.

Type

array

Methods

__construct()

__construct(string  $id,string  $title,string  $message,array  $options = array())

Constructor.

Parameters

string $id

A unique ID for this notice. Can contain lowercase characters and underscores.

string $title

The title for our notice.

string $message

The message for our notice.

array $options

An array of additional options to change the defaults for this notice. [ 'screens' => (array) An array of screens where the notice will be displayed. Leave empty to always show. Defaults to an empty array. 'scope' => (string) Can be "global" or "user". Determines if the dismissed status will be saved as an option or user-meta. Defaults to "global". 'type' => (string) Can be one of "info", "success", "warning", "error". Defaults to "info". 'alt_style' => (bool) Whether we want to use alt styles or not. Defaults to false. 'capability' => (string) The user capability required to see the notice. Defaults to "edit_theme_options". 'option_prefix' => (string) The prefix that will be used to build the option (or post-meta) name. Can contain lowercase latin letters and underscores. ].

the_notice()

the_notice(): void

Prints the notice.

show()

show(): boolean

Determine if the notice should be shown or not.

Returns

boolean

get_classes()

get_classes(): string

Get the notice classes.

Returns

string

get_title()

get_title(): string

Returns the title.

Returns

string

get_message()

get_message(): string

Returns the message.

Returns

string

is_screen()

is_screen(): boolean

Evaluate if we're on the right place depending on the "screens" argument.

Returns

boolean