WC_Admin_Settings
in package
WC_Admin_Settings Class.
Table of Contents
- $errors : array<string|int, mixed>
- Error messages.
- $messages : array<string|int, mixed>
- Update messages.
- $settings : array<string|int, mixed>
- Setting pages.
- add_error() : mixed
- Add an error.
- add_message() : mixed
- Add a message.
- check_download_folder_protection() : mixed
- Checks which method we're using to serve downloads.
- get_field_description() : array<string|int, mixed>
- Helper function to get the formatted description and tip HTML for a given form field. Plugins can call this when implementing their own custom settings types.
- get_option() : mixed
- Get a setting from the settings API.
- get_settings_pages() : mixed
- Include the settings page classes.
- output() : mixed
- Settings page.
- output_fields() : mixed
- Output admin fields.
- save() : mixed
- Save the settings.
- save_fields() : bool
- Save admin fields.
- show_messages() : mixed
- Output messages + errors.
Properties
$errors
Error messages.
private
static array<string|int, mixed>
$errors
= array()
$messages
Update messages.
private
static array<string|int, mixed>
$messages
= array()
$settings
Setting pages.
private
static array<string|int, mixed>
$settings
= array()
Methods
add_error()
Add an error.
public
static add_error(string $text) : mixed
Parameters
- $text : string
-
Message.
Return values
mixed —add_message()
Add a message.
public
static add_message(string $text) : mixed
Parameters
- $text : string
-
Message.
Return values
mixed —check_download_folder_protection()
Checks which method we're using to serve downloads.
public
static check_download_folder_protection() : mixed
If using force or x-sendfile, this ensures the .htaccess is in place.
Return values
mixed —get_field_description()
Helper function to get the formatted description and tip HTML for a given form field. Plugins can call this when implementing their own custom settings types.
public
static get_field_description(array<string|int, mixed> $value) : array<string|int, mixed>
Parameters
- $value : array<string|int, mixed>
-
The form field value array.
Return values
array<string|int, mixed> — The description and tip as a 2 element array.get_option()
Get a setting from the settings API.
public
static get_option(string $option_name[, mixed $default = '' ]) : mixed
Parameters
- $option_name : string
-
Option name.
- $default : mixed = ''
-
Default value.
Return values
mixed —get_settings_pages()
Include the settings page classes.
public
static get_settings_pages() : mixed
Return values
mixed —output()
Settings page.
public
static output() : mixed
Handles the display of the main woocommerce settings page in admin.
Return values
mixed —output_fields()
Output admin fields.
public
static output_fields(array<string|int, array<string|int, mixed>> $options) : mixed
Loops through the woocommerce options array and outputs each field.
Parameters
- $options : array<string|int, array<string|int, mixed>>
-
Opens array to output.
Return values
mixed —save()
Save the settings.
public
static save() : mixed
Return values
mixed —save_fields()
Save admin fields.
public
static save_fields(array<string|int, mixed> $options[, array<string|int, mixed> $data = null ]) : bool
Loops through the woocommerce options array and outputs each field.
Parameters
- $options : array<string|int, mixed>
-
Options array to output.
- $data : array<string|int, mixed> = null
-
Optional. Data to use for saving. Defaults to $_POST.
Return values
bool —show_messages()
Output messages + errors.
public
static show_messages() : mixed