Properties

$options

$options : array

Type

normal

$constant_backed_ids

$constant_backed_ids : array|null

Cached list of option ids whose value is stored as a wp-config.php constant (the `api_key` settings fields). Null until first resolved. Populated from the `um_api_key_option_ids` option (kept in sync by {@see \um\admin\core\Admin_Settings::init_variables()}).

Type

normal

Methods

__construct()

__construct() : mixed

Options constructor.

Returns

mixed

get_constant_backed_ids()

get_constant_backed_ids() : array

Get the list of option ids whose value is stored as a wp-config.php constant.

These are the api_key settings fields. The list is derived from the settings structure (admin) and persisted to the um_api_key_option_ids option so it is also available on the frontend, where the settings structure is not built. Extensions can add ids via the filter.

Returns

array —

List of option ids.

set_constant_backed_ids()

set_constant_backed_ids(array  $ids) : mixed

Persist the list of constant-backed option ids and refresh the in-memory cache.

Parameters

array $ids

Option ids of the api_key fields.

Returns

mixed

is_constant_backed()

is_constant_backed(string  $option_id) : bool

Whether an option's value is stored as a wp-config.php constant (i.e. it is an `api_key` field).

Parameters

string $option_id

Returns

bool

get_constant_name()

get_constant_name(string  $option_id) : string

Get the wp-config.php constant name that backs a given option.

Only api_key settings fields are constant-backed (see \um\core\is_constant_backed()); for any other option this returns an empty string so the constant lookup in \um\core\get() is skipped. The mapping is convention based: the uppercased option id prefixed with UM_OPTION_ (e.g. stripe_test_secret_keyUM_OPTION_STRIPE_TEST_SECRET_KEY).

Parameters

string $option_id

Returns

string —

Constant name, or empty string when the option is not constant-backed.

get()

get(string  $option_id) : mixed

Get UM option value.

Parameters

string $option_id

Returns

mixed

update()

update( $option_id,  $value) : mixed

Update UM option value

Parameters

$option_id
$value

Returns

mixed

remove()

remove( $option_id) : mixed

Delete UM option

Parameters

$option_id

Returns

mixed

get_default()

get_default(string  $option_id) : mixed

Get UM option default value

Parameters

string $option_id

Returns

mixed

get_predefined_page_option_key()

get_predefined_page_option_key(string  $slug) : string

Get predefined page option key

Parameters

string $slug

Returns

string

get_core_page_id()

get_core_page_id(string  $key) : string

Get core page ID

Parameters

string $key

Returns

string

init_variables()

init_variables() : mixed

Set variables

Returns

mixed