Documentation

AbstractRevisionPersistance
in package

AbstractYes

Additional to `Revision`, this abstract class provides persistence settings for the revision, e.g. generating the cookie name, persisting revisions to database and so on.

Table of Contents

Properties

$revision  : Revision
See `Revision`.

Methods

alterRevision()  : array<string|int, mixed>
Overwrite this method to modify the revision object. This allows you to add additional data to the revision.
alterRevisionIndependent()  : array<string|int, mixed>
Overwrite this method to modify the independent revision object. This allows you to add additional data to the revision.
getContextVariablesExplicit()  : array<string|int, mixed>
Get explicit context relevant options like language code (WPML, PolyLang). If the language changes, a new revision will be created or requested so they are completely independent.
getContextVariablesImplicit()  : mixed
Get implicit context relevant options like blog id. Implicit context variables are not populated to the context, nor to the revision. Use this only if you want to modify the cookie name!
getContextVariablesString()  : mixed
Get context relevant options as string so they can be used as cookie name or option name.
getCurrentHash()  : mixed
Get the current active revision hash. Can also return a falsy value when no hash is currently generated.
getCurrentHashTime()  : int
Get the time when the current active revision hash got updated. Can also return `0` value when no hash is currently generated.
getRevision()  : mixed
Getter.
persist()  : mixed
Persist an revision JSON string to database.
persistIndependent()  : mixed
Persist an independent revision JSON string to database.
setRevision()  : mixed
Setter.

Properties

Methods

alterRevision()

Overwrite this method to modify the revision object. This allows you to add additional data to the revision.

public alterRevision(array<string|int, mixed> &$revision) : array<string|int, mixed>
Parameters
$revision : array<string|int, mixed>
Return values
array<string|int, mixed>

alterRevisionIndependent()

Overwrite this method to modify the independent revision object. This allows you to add additional data to the revision.

public alterRevisionIndependent(array<string|int, mixed> &$revision) : array<string|int, mixed>
Parameters
$revision : array<string|int, mixed>
Return values
array<string|int, mixed>

getContextVariablesExplicit()

Get explicit context relevant options like language code (WPML, PolyLang). If the language changes, a new revision will be created or requested so they are completely independent.

public abstract getContextVariablesExplicit() : array<string|int, mixed>

They also get populated to the generated revision.

Warning: Cookie names cannot contain any of the following '=,; \t\r\n\013\014', so please make sure such characters are not stored in your value (if so, they get replaced with underscore _).

Return values
array<string|int, mixed>

getContextVariablesImplicit()

Get implicit context relevant options like blog id. Implicit context variables are not populated to the context, nor to the revision. Use this only if you want to modify the cookie name!

public abstract getContextVariablesImplicit() : mixed

Warning: Cookie names cannot contain any of the following '=,; \t\r\n\013\014', so please make sure such characters are not stored in your value (if so, they get replaced with underscore _).

getContextVariablesString()

Get context relevant options as string so they can be used as cookie name or option name.

public getContextVariablesString([bool $implicit = false ]) : mixed
Parameters
$implicit : bool = false

If true, implicit context variables are parsed, otherwise explicit context variables

getCurrentHash()

Get the current active revision hash. Can also return a falsy value when no hash is currently generated.

public abstract getCurrentHash() : mixed

getCurrentHashTime()

Get the time when the current active revision hash got updated. Can also return `0` value when no hash is currently generated.

public abstract getCurrentHashTime() : int
Return values
int

persist()

Persist an revision JSON string to database.

public abstract persist(array<string|int, mixed> $result, bool $forceNewConsent) : mixed
Parameters
$result : array<string|int, mixed>

revision and hash

$forceNewConsent : bool

If true update the hash to the database so getCurrentHash() returns that hash and getCurrentHashTime() returns the time of hash update

persistIndependent()

Persist an independent revision JSON string to database.

public abstract persistIndependent(array<string|int, mixed> $result) : mixed
Parameters
$result : array<string|int, mixed>

revision and hash


        
On this page

Search results