Documentation

Setting
in package

Class defining a configurable plugin setting.

Tags
since
2.8.0

Table of Contents

FONT_SIZE_UNIT_OPTIONS  = array('em' => 'em', 'rem' => 'rem', 'px' => 'pixels', 'pt' => 'points', 'pc' => 'picas', 'mm' => 'millimeters', '%' => 'per cent')
Options for the custom font size units (per cent is a ratio, not a unit).
TEXT_ELEMENT_OPTIONS  = array('p' => 'paragraph', 'h2' => 'heading 2', 'h3' => 'heading 3', 'h4' => 'heading 4', 'h5' => 'heading 5', 'h6' => 'heading 6')
Options for the HTML text elements.
WIDTH_UNIT_OPTIONS  = array('%' => 'per cent', 'px' => 'pixels', 'rem' => 'root em', 'em' => 'em', 'vw' => 'viewport width')
Options for the custom width units (per cent is a ratio, not a unit).
$description  : string|null
Setting description.
$key  : string
Setting slug.
$name  : string
Setting name.
$value  : mixed
Setting value.
$default_value  : mixed
Setting default value.
$enabled_by  : string|null
The setting for whether this setting is enabled or not.
$group_id  : string
Setting group ID.
$input_max  : int|float|null
Setting input field max. value (for 'number' inputs).
$input_min  : int|float|null
Setting input field min. value (for 'number' inputs).
$input_options  : array<string|int, mixed>|null
Setting input field options (for 'select' inputs).
$input_type  : string
Setting input field type.
$options_group_slug  : string
Setting section slug.
$overridden_by  : string|null
Any setting that overrides this setting.
$section_slug  : string
Setting section slug.
$settings  : Settings
The plugin settings object.
$type  : string
Setting data type.
__construct()  : mixed
Constructs the setting.
get_default_value()  : mixed
Gets the default value of the setting.
get_input_options()  : array<string|int, mixed>|null
Gets the input options of the setting.
get_options_group_slug()  : string
Gets the slug of the setting's options group.
get_section_slug()  : string
Gets the slug of the setting's section.
get_setting_args()  : array<string|int, mixed>
Get the args for registering the settings with WordPress.
get_setting_field_args()  : array<string|int, mixed>
Get the args for rendering setting fields on the admin. dashboard.
get_value()  : mixed
Gets the value of the setting.
set_value()  : bool
Sets the value of the setting.
is_disabled_or_overridden()  : bool|null
Check whether a setting is enabled and/or overridden.

Constants

FONT_SIZE_UNIT_OPTIONS

Options for the custom font size units (per cent is a ratio, not a unit).

public array<string|int, mixed> FONT_SIZE_UNIT_OPTIONS = array('em' => 'em', 'rem' => 'rem', 'px' => 'pixels', 'pt' => 'points', 'pc' => 'picas', 'mm' => 'millimeters', '%' => 'per cent')
Tags
since
2.8.0

TEXT_ELEMENT_OPTIONS

Options for the HTML text elements.

public array<string|int, mixed> TEXT_ELEMENT_OPTIONS = array('p' => 'paragraph', 'h2' => 'heading 2', 'h3' => 'heading 3', 'h4' => 'heading 4', 'h5' => 'heading 5', 'h6' => 'heading 6')
Tags
since
2.8.0

WIDTH_UNIT_OPTIONS

Options for the custom width units (per cent is a ratio, not a unit).

public array<string|int, mixed> WIDTH_UNIT_OPTIONS = array('%' => 'per cent', 'px' => 'pixels', 'rem' => 'root em', 'em' => 'em', 'vw' => 'viewport width')
Tags
since
2.8.0

Properties

$description

Setting description.

public string|null $description
Tags
since
2.8.0

$value

Setting value.

protected mixed $value
Tags
since
2.8.0

$default_value

Setting default value.

private mixed $default_value
Tags
since
2.8.0

$enabled_by

The setting for whether this setting is enabled or not.

private string|null $enabled_by
Tags
since
2.8.0

$group_id

Setting group ID.

private string $group_id
Tags
since
2.8.0

$input_max

Setting input field max. value (for 'number' inputs).

private int|float|null $input_max
Tags
since
2.8.0

$input_min

Setting input field min. value (for 'number' inputs).

private int|float|null $input_min
Tags
since
2.8.0

$input_options

Setting input field options (for 'select' inputs).

private array<string|int, mixed>|null $input_options
Tags
since
2.8.0

$input_type

Setting input field type.

private string $input_type
Tags
since
2.8.0

$options_group_slug

Setting section slug.

private string $options_group_slug
Tags
since
2.8.0

$overridden_by

Any setting that overrides this setting.

private string|null $overridden_by
Tags
since
2.8.0

$section_slug

Setting section slug.

private string $section_slug
Tags
since
2.8.0

$type

Setting data type.

private string $type
Tags
since
2.8.0

Methods

__construct()

Constructs the setting.

public __construct(string $group_id, string $options_group_slug, string $section_slug, string $key, string $name, string|null $description, mixed $default_value, string $type, string $input_type, array<string|int, mixed>|null $input_options, int|float|null $input_max, int|float|null $input_min, string|null $enabled_by, string|null $overridden_by, Settings $settings) : mixed
Parameters
$group_id : string
$options_group_slug : string
$section_slug : string
$key : string
$name : string
$description : string|null
$default_value : mixed
$type : string
$input_type : string
$input_options : array<string|int, mixed>|null
$input_max : int|float|null
$input_min : int|float|null
$enabled_by : string|null
$overridden_by : string|null
$settings : Settings
Tags
since
2.8.0
Return values
mixed

get_default_value()

Gets the default value of the setting.

public get_default_value() : mixed
Tags
since
2.8.0
Return values
mixed

The default value of the setting. 'None' if one is not set.

get_input_options()

Gets the input options of the setting.

public get_input_options() : array<string|int, mixed>|null
Tags
since
2.8.0
Return values
array<string|int, mixed>|null

The possible options of the setting. 'None' if no options are set.

get_options_group_slug()

Gets the slug of the setting's options group.

public get_options_group_slug() : string
Tags
since
2.8.0
Return values
string

The options group slug.

get_section_slug()

Gets the slug of the setting's section.

public get_section_slug() : string
Tags
since
2.8.0
Return values
string

The section slug.

get_setting_args()

Get the args for registering the settings with WordPress.

public get_setting_args() : array<string|int, mixed>
Tags
see
register_setting()
since
2.8.0
Return values
array<string|int, mixed>

The setting field args.

get_setting_field_args()

Get the args for rendering setting fields on the admin. dashboard.

public get_setting_field_args() : array<string|int, mixed>
Tags
see
add_settings_field()
since
2.8.0
Return values
array<string|int, mixed>

The setting field args.

get_value()

Gets the value of the setting.

public get_value() : mixed
Tags
since
2.8.0
Return values
mixed

The value of the setting, or the default value if none is set. 'None' if neither are set.

set_value()

Sets the value of the setting.

public set_value(mixed $value) : bool
Parameters
$value : mixed

The new value to set.

Tags
since
2.8.0
Return values
bool

'True' if the value was successfully set. 'False' otherwise.

is_disabled_or_overridden()

Check whether a setting is enabled and/or overridden.

private is_disabled_or_overridden() : bool|null
Tags
since
2.8.0
Return values
bool|null

'True' if the setting is disabled or overridden. 'False' if it could be, but isn't currently. 'None' if the setting is not enabled/overridden by another.

Search results