Documentation

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
see
https://developer.wordpress.org/reference/hooks/option_option/
see
https://developer.wordpress.org/reference/hooks/update_option_option/

Table of Contents

Constants

DEFAULT_USE_NON_EMPTY_FROM_OTHER_LANGUAGES  = 1

Properties

$comp  : AbstractSyncPlugin
See AbstractSyncPlugin.
$default  : mixed
$defaultBehavior  : mixed
$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

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
codeCoverageIgnore

getDefaultBehavior()

Get default value behavior.

public getDefaultBehavior() : mixed
Tags
codeCoverageIgnore

getOriginalOptionName()

Get original option name.

public getOriginalOptionName() : 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