WooCommerce Code Reference

WC_Admin_Settings
in package

WC_Admin_Settings Class.

Table of Contents

$errors  : array
Error messages.
$messages  : array
Update messages.
$settings  : array
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
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

Methods

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 $value) : array
Parameters
$value : array

The form field value array.

Return values
arrayThe 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

output_fields()

Output admin fields.

public static output_fields(array[] $options) : mixed

Loops through the woocommerce options array and outputs each field.

Parameters
$options : array[]

Opens array to output.

Return values
mixed

save_fields()

Save admin fields.

public static save_fields(array $options[, array $data = null ]) : bool

Loops through the woocommerce options array and outputs each field.

Parameters
$options : array

Options array to output.

$data : array = null

Optional. Data to use for saving. Defaults to $_POST.

Return values
bool