CoolCMS API

InitTrait

Table of Contents

Constants

COOKIE_NAME  : mixed = 'cms_cookie_consent'
Must match the `COOKIE_NAME` constant in `assets/js/components/cookie-bar.js`.

Methods

prepareTemplate()  : void
Categories, consent lifetime and consent revision.
resolvePolicyLink()  : string|null
Link to the cookie policy page, determined by the setting `cookie.policy.pageId` (module 1).

Constants

Must match the `COOKIE_NAME` constant in `assets/js/components/cookie-bar.js`.

private mixed COOKIE_NAME = 'cms_cookie_consent'

Methods

prepareTemplate()

Categories, consent lifetime and consent revision.

private prepareTemplate() : void

They live in config/Shared/cookieConsent.neon, not in constants here: the admin needs the same list (the cookie consent choice of custom code) and two copies drift apart silently, so the admin could offer a category the bar does not and the script would wait for consent forever.

IMPORTANT: passed through the constructor by the factory, not via #[Inject]. Components are created with plain new and BaseComponentFactory::initControl() only calls setupAppContext() and onCreate(); an attribute would leave the property uninitialized and the first read would fail with "must not be accessed before initialization".

Link to the cookie policy page, determined by the setting `cookie.policy.pageId` (module 1).

private resolvePolicyLink() : string|null

Without it the link is not rendered and the bar shows text only.

Return values
string|null
On this page

Search results