Settings_Util
Utility functions for the Plugin settings.
Tags
Table of Contents
- bool_to_checkbox_setting() : mixed
- checkbox_setting_to_bool() : mixed
- get_checkbox_option() : mixed
- get_custom_attributes() : mixed
- get_title_description() : string
- Return the description for the main title of a settings tab/section including the links below the description (as a filterable array of [ 'url', 'label', 'class' ])
- is_current_settings_page() : bool
- Check whether the current page, tab and section match the ones the plugin uses
- is_current_wc_settings_page() : bool
- A shorthand of is_current_settings_page for WooCommerce plugins
Methods
bool_to_checkbox_setting()
public
static bool_to_checkbox_setting(mixed $bool) : mixed
Parameters
- $bool : mixed
Return values
mixed —checkbox_setting_to_bool()
public
static checkbox_setting_to_bool(mixed $value) : mixed
Parameters
- $value : mixed
Return values
mixed —get_checkbox_option()
public
static get_checkbox_option(mixed $option[, mixed $default = false ]) : mixed
Parameters
- $option : mixed
- $default : mixed = false
Return values
mixed —get_custom_attributes()
public
static get_custom_attributes(mixed $field) : mixed
Parameters
- $field : mixed
Return values
mixed —get_title_description()
Return the description for the main title of a settings tab/section including the links below the description (as a filterable array of [ 'url', 'label', 'class' ])
public
static get_title_description(Plugin $plugin, string $description) : string
Parameters
- $plugin : Plugin
- $description : string
-
The text of the description
Return values
string —is_current_settings_page()
Check whether the current page, tab and section match the ones the plugin uses
public
static is_current_settings_page(string $page[, string $tab = '' ][, string $section = '' ]) : bool
Parameters
- $page : string
-
The slug of the page for the plugin settings.
- $tab : string = ''
-
The slug of the tab for the plugin settings. Default to an empty string.
- $section : string = ''
-
The slug of the section for the plugin settings. Default to an empty string.
Return values
bool —is_current_wc_settings_page()
A shorthand of is_current_settings_page for WooCommerce plugins
public
static is_current_wc_settings_page(string $section[, string $tab = 'products' ]) : bool
Parameters
- $section : string
-
The slug of the section for the plugin settings.
- $tab : string = 'products'
-
The slug of the tab for the plugin settings. Default to 'products'.