WooCommerce Code Reference

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

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<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

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_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