LanguageDependingOption
in package
Make a given option langugae-depending. That means, reading a option by a unique name reads the value of the option from the language 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
Constants
Properties
- $comp : AbstractSyncPlugin
- See AbstractSyncPlugin.
- $default : mixed
- $defaultBehavior : mixed
- $defaultLanguage : string
- The language of the passed `$default` value.
- $originalOptionName : mixed
Methods
- __construct() : mixed
- C'tor.
- getComp() : mixed
- Get AbstractSyncPlugin.
- getDefault() : mixed
- Get default value.
- getDefaultBehavior() : mixed
- Get default value behavior.
- getOriginalOptionName() : mixed
- Get original option name.
- pre_option() : mixed
- Read from original value.
- pre_update_option() : mixed
- Redirect the update of the context.
- fetchDefaultValue() : mixed
- Fetch the default behavior.
- getOptionName() : mixed
- Get option name for this context.
- hooks() : mixed
- Initialize hooks.
Constants
DEFAULT_USE_NON_EMPTY_FROM_OTHER_LANGUAGES
public
mixed
DEFAULT_USE_NON_EMPTY_FROM_OTHER_LANGUAGES
= 1
Properties
$comp
See AbstractSyncPlugin.
private
AbstractSyncPlugin
$comp
$default
private
mixed
$default
$defaultBehavior
private
mixed
$defaultBehavior
$defaultLanguage
The language of the passed `$default` value.
private
string
$defaultLanguage
$originalOptionName
private
mixed
$originalOptionName
Methods
__construct()
C'tor.
public
__construct(AbstractSyncPlugin $comp, string $originalOptionName, mixed $default[, int $defaultBehavior = 0 ]) : mixed
Parameters
- $comp : AbstractSyncPlugin
- $originalOptionName : string
- $default : mixed
- $defaultBehavior : int = 0
-
See
DEFAULT_
constants
Tags
getComp()
Get AbstractSyncPlugin.
public
getComp() : mixed
Tags
getDefault()
Get default value.
public
getDefault() : mixed
Tags
getDefaultBehavior()
Get default value behavior.
public
getDefaultBehavior() : 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.
fetchDefaultValue()
Fetch the default behavior.
protected
fetchDefaultValue() : mixed
getOptionName()
Get option name for this context.
protected
getOptionName() : mixed
hooks()
Initialize hooks.
protected
hooks() : mixed