Settings
in package
Class defining configurable plugin settings.
Tags
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
$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
Methods
__construct()
Loads all Settings from each WordPress Settings Container.
public
__construct() : mixed
Tags
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
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
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
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
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
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
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:
- SettingsSection: defines a section of settings groups;
- SettingsGroup: defines a group of settings;
- Setting: defines a single setting;
- GeneralSettingsSection: provides general plugin settings;
- ReferrersAndTooltipsSettingsSection: provides settings for customising the plugin's created referrers and tooltips;
- ScopeAndPrioritySettingsSection: defines plugin scope and priority settings; and
- CustomCSSSettingsSection: provides custom CSS settings.
Tags
Return values
void —load_options_groups()
Loads all settings from each option group.
protected
load_options_groups() : void