Documentation

RevisionContextDependingOption
in package

Make a given option context-depending. That means, reading a option by a unique name reads the value of the option from the revision context. This also works for write.

Note: You need to refactor your update_option_{option} and option_{option} hooks to listen to all changes, perhaps with a startsWith().

Tags
see
https://developer.wordpress.org/reference/hooks/option_option/
see
https://developer.wordpress.org/reference/hooks/update_option_option/

Table of Contents

Properties

$default  : mixed
$originalOptionName  : mixed

Methods

__construct()  : mixed
C'tor.
getDefault()  : mixed
Get default value.
getOriginalOptionName()  : mixed
Get original option name.
pre_option()  : mixed
Read from original value.
pre_update_option()  : mixed
Redirect the update of the context.
getOptionName()  : mixed
Get option name for this context.
hooks()  : mixed
Initialize hooks.

Properties

Methods

__construct()

C'tor.

public __construct(string $originalOptionName, mixed $default) : mixed
Parameters
$originalOptionName : string
$default : mixed
Tags
codeCoverageIgnore

pre_option()

Read from original value.

public pre_option(mixed $pre_option, string $option) : mixed
Parameters
$pre_option : mixed
$option : string

pre_update_option()

Redirect the update of the context.

public pre_update_option(mixed $value, mixed $old_value, string $option) : mixed
Parameters
$value : mixed

The new, unserialized option value.

$old_value : mixed

The old option value.

$option : string

Option name.


        
On this page

Search results