Documentation

Frontend
in package

Functions for the frontend (e.g. generating "Code on page load" HTML output).

Table of Contents

Constants

COOKIE_NAME_SUFFIX_GCM  = '-gcm'
COOKIE_NAME_SUFFIX_TCF  = '-tcf'
COOKIE_NAME_USER_PREFIX  = 'real_cookie_banner'

Properties

$cookieConsentManagement  : CookieConsentManagement
See `CookieConsentManagement`.

Methods

__construct()  : mixed
C'tor.
generateCodeOnPageLoad()  : array<string|int, string>
Generate the "Code on page load" for all our configured services.
getCookieConsentManagement()  : mixed
Getter.
getCookieName()  : mixed
Get the cookie name for the consent decision.
prepareLazyData()  : mixed
The `toJson` method prepares the data for the complete data of the frontend. Use this function to outsource lazy-loadable data for the second view in your cookie banner.
toJson()  : mixed
Generate an array which can be used for the frontend to show the cookie banner / content blocker to the website visitor.
generateGoogleConsentModeCodeOnPageLoad()  : mixed
Generate the code on page load for Google Consent Mode.

Constants

public mixed COOKIE_NAME_SUFFIX_GCM = '-gcm'
public mixed COOKIE_NAME_SUFFIX_TCF = '-tcf'
public mixed COOKIE_NAME_USER_PREFIX = 'real_cookie_banner'

Properties

Methods

generateCodeOnPageLoad()

Generate the "Code on page load" for all our configured services.

public generateCodeOnPageLoad([callable $outputModifier = null ]) : array<string|int, string>
Parameters
$outputModifier : callable = null

Allows to modify the HTML output of a single service by a function

Return values
array<string|int, string>

getCookieConsentManagement()

Getter.

public getCookieConsentManagement() : mixed
Tags
codeCoverageIgnore

getCookieName()

Get the cookie name for the consent decision.

public getCookieName([string $suffix = '' ]) : mixed
Parameters
$suffix : string = ''

See also constants starting with COOKIE_NAME_SUFFIX_

prepareLazyData()

The `toJson` method prepares the data for the complete data of the frontend. Use this function to outsource lazy-loadable data for the second view in your cookie banner.

public prepareLazyData(array<string|int, mixed> &$output[, bool $appendStateToOutput = false ]) : mixed
Parameters
$output : array<string|int, mixed>
$appendStateToOutput : bool = false

If true, a hasLazyData property will be added to the passe $output object

toJson()

Generate an array which can be used for the frontend to show the cookie banner / content blocker to the website visitor.

public toJson() : mixed

Behind the scenes, it reuses Revision where possible.

generateGoogleConsentModeCodeOnPageLoad()

Generate the code on page load for Google Consent Mode.

protected generateGoogleConsentModeCodeOnPageLoad() : mixed

        
On this page

Search results