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
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
$default
private
mixed
$default
$originalOptionName
private
mixed
$originalOptionName
Methods
__construct()
C'tor.
public
__construct(string $originalOptionName, mixed $default) : mixed
Parameters
- $originalOptionName : string
- $default : mixed
Tags
getDefault()
Get default value.
public
getDefault() : mixed
Tags
getOriginalOptionName()
Get original option name.
public
getOriginalOptionName() : mixed
Tags
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.
getOptionName()
Get option name for this context.
protected
getOptionName() : mixed
hooks()
Initialize hooks.
protected
hooks() : mixed