Documentation

Settings
in package

Class defining configurable plugin settings.

Tags
since
1.5.0
since
2.8.0

Renamed class from Footnotes_Settings to Settings. Moved under footnotes\includes namespace.

Table of Contents

$settings_sections  : array<string|int, SettingsSection>
Contains each section of settings.
$options_group_slugs  : array<string|int, mixed>
Contains all Settings option group slugs.
__construct()  : mixed
Loads all Settings from each WordPress Settings Container.
get_options_group_slug()  : string
Returns the name of a specified Settings Container.
get_setting()  : Setting|null
Retrieve a setting by its key.
get_setting_default_value()  : mixed
Retrieve a setting's default value by its key.
get_setting_value()  : mixed
Retrieve a setting's value by its key.
save_options_group()  : bool
Updates a whole Setting Container on save.
set_setting_value()  : mixed
Set a setting's value by its key.
load_dependencies()  : void
Load the required dependencies for this file.
load_options_groups()  : void
Loads all settings from each option group.

Properties

$settings_sections

Contains each section of settings.

public array<string|int, SettingsSection> $settings_sections = array()
Tags
since
2.8.0

$options_group_slugs

Contains all Settings option group slugs.

private array<string|int, mixed> $options_group_slugs = array('footnotes_storage', 'footnotes_storage_custom', 'footnotes_storage_expert', 'footnotes_storage_custom_css')

Each option group relates to a single tab on the admin. dashboard.

Tags
since
1.5.0
since
2.8.0

Renamed from container to options_group_slugs.

Methods

__construct()

Loads all Settings from each WordPress Settings Container.

public __construct() : mixed
Tags
since
1.5.0
Return values
mixed

get_options_group_slug()

Returns the name of a specified Settings Container.

public get_options_group_slug(int $index) : string
Parameters
$index : int

Options group index.

Tags
since
1.5.0
since
2.8.0

Renamed from get_container() to get_options_group_slug().

Return values
string

Options group slug name.

get_setting()

Retrieve a setting by its key.

public get_setting(string $setting_key) : Setting|null
Parameters
$setting_key : string

The key of the setting to search for.

Tags
since
2.8.0
todo

This is an O(n) linear search. Explore more scaleable alternatives.

Return values
Setting|null

Either the setting object, or null if none exists.

get_setting_default_value()

Retrieve a setting's default value by its key.

public get_setting_default_value(string $setting_key) : mixed
Parameters
$setting_key : string

The key of the setting to search for.

Tags
since
2.8.0
todo

This is an O(n) linear search. Explore more scaleable alternatives.

todo

How to handle settings with a default value of null?

Return values
mixed

Either the setting's default value, or null if the setting does not exist.

get_setting_value()

Retrieve a setting's value by its key.

public get_setting_value(string $setting_key) : mixed
Parameters
$setting_key : string

The key of the setting to search for.

Tags
since
2.8.0
todo

This is an O(n) linear search. Explore more scaleable alternatives.

todo

How to handle settings with a value of null?

Return values
mixed

Either the setting's value, or null if the setting does not exist.

save_options_group()

Updates a whole Setting Container on save.

public save_options_group(string $options_group_slug, array<string|int, mixed> $new_values) : bool
Parameters
$options_group_slug : string

Options group slug to save.

$new_values : array<string|int, mixed>

The new Settings value(s).

Tags
since
1.5.0
since
2.8.0

Change first parameter type from int to string.

Return values
bool

set_setting_value()

Set a setting's value by its key.

public set_setting_value(string $setting_key, mixed $setting_value) : mixed
Parameters
$setting_key : string

The key of the setting to search for.

$setting_value : mixed

The new value to set.

Tags
since
2.8.0
todo

This is an O(n) linear search. Explore more scaleable alternatives.

todo

How to handle settings with a value of null?

Return values
mixed

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

load_dependencies()

Load the required dependencies for this file.

protected load_dependencies() : void

Includes the following files that make up the plugin:

Tags
since
2.8.0
Return values
void

load_options_groups()

Loads all settings from each option group.

protected load_options_groups() : void
Tags
since
1.5.0
since
2.8.0

Renamed from load_all() to load_options_groups().

Return values
void

Search results