Cookies
Table of Contents
Constants
- SYSTEM_COOKIES = [ 'ga' => ['type' => 'analytic'], // google analytics 'gtm' => ['type' => 'analytic'], // google tag manager 'ym' => ['type' => 'analytic'], // yandex metrika 'fbp' => ['type' => 'analytic'], // facebook pixel 'vkp' => ['type' => 'analytic'], // vkontakte pixel 'yt' => ['type' => 'technical'], // youtube 'gmap' => ['type' => 'technical'], ]
- System cookie codes.
- USER_CONSENT_CODE = 'landing_cookies'
- Unique code for user consent table.
Methods
- acceptAgreement() : void
- Accepts agreement with specific cookies codes.
- addAgreementForSite() : AddResult
- Add new agreements for the site.
- getAgreements() : array<string|int, mixed>
- Returns system agreements for site.
- getMainAgreement() : array<string|int, mixed>
- Creates new agreement for current language, if not exists.
- isSiteIncludesScript() : bool
- Checks if site (site itself, any site page and any blocks on the pages in this site) includes any javascript code.
- onUserConsentProviderList() : EventResult
- Prepares cookies codes for user consents grid.
- removeAgreementsForSite() : void
- Removes all agreements for the site.
- updateAgreementForSite() : UpdateResult
- Update agreements for the site.
Constants
SYSTEM_COOKIES
System cookie codes.
public
mixed
SYSTEM_COOKIES
= [
'ga' => ['type' => 'analytic'],
// google analytics
'gtm' => ['type' => 'analytic'],
// google tag manager
'ym' => ['type' => 'analytic'],
// yandex metrika
'fbp' => ['type' => 'analytic'],
// facebook pixel
'vkp' => ['type' => 'analytic'],
// vkontakte pixel
'yt' => ['type' => 'technical'],
// youtube
'gmap' => ['type' => 'technical'],
]
USER_CONSENT_CODE
Unique code for user consent table.
public
mixed
USER_CONSENT_CODE
= 'landing_cookies'
Methods
acceptAgreement()
Accepts agreement with specific cookies codes.
public
static acceptAgreement(int $siteId[, array<string|int, mixed> $accepted = [] ]) : void
Parameters
- $siteId : int
-
Site id.
- $accepted : array<string|int, mixed> = []
-
Accepted cookies codes.
addAgreementForSite()
Add new agreements for the site.
public
static addAgreementForSite(int $siteId, array<string|int, mixed> $fields) : AddResult
Parameters
- $siteId : int
-
Site id.
- $fields : array<string|int, mixed>
-
Data array ([CODE, TITLE, CONTENT]).
Return values
AddResultgetAgreements()
Returns system agreements for site.
public
static getAgreements(int $siteId[, bool $viewMode = false ]) : array<string|int, mixed>
Parameters
- $siteId : int
-
Site id.
- $viewMode : bool = false
-
Skip raw data with tilda-key and prepare content.
Return values
array<string|int, mixed>getMainAgreement()
Creates new agreement for current language, if not exists.
public
static getMainAgreement([int|null $agreementId = null ]) : array<string|int, mixed>
Parameters
- $agreementId : int|null = null
Return values
array<string|int, mixed>isSiteIncludesScript()
Checks if site (site itself, any site page and any blocks on the pages in this site) includes any javascript code.
public
static isSiteIncludesScript(int $siteId) : bool
Parameters
- $siteId : int
-
Site id.
Return values
boolonUserConsentProviderList()
Prepares cookies codes for user consents grid.
public
static onUserConsentProviderList() : EventResult
Return values
EventResultremoveAgreementsForSite()
Removes all agreements for the site.
public
static removeAgreementsForSite(int $siteId[, string $code = null ]) : void
Parameters
- $siteId : int
-
Site id.
- $code : string = null
-
Cookie code.
updateAgreementForSite()
Update agreements for the site.
public
static updateAgreementForSite(int $agreementId, array<string|int, mixed> $fields) : UpdateResult
Parameters
- $agreementId : int
-
Agreement id.
- $fields : array<string|int, mixed>
-
Data array ([TITLE, CONTENT]).