Skip to content

restruct/silverstripe-cookiebar

Repository files navigation

Cookiebar Module

Configurable notice about cookies, a link to a page about them and an 'accept' link to close the notice (based on the cookiebar module by Aram Balakjian & Steve Heyes).

Screenshot 2022-07-02 at 14 13 29

Installation

Install via composer require and add $CookieBar just before the closing body tag:

...
    $CookieBar
</body>

The included template uses bootstrap for its layout. In case the site theme does not use bootstrap, a 'sans-bs' CSS file can be included which provides a fallback layout (see config).

Configuration

The texts and image can be controlled from the CMS (SiteConfig).
Config options (with their defaults):

Restruct\CookieBar\Controls\CookieBarController:
  sans_bs_css: false # include no-bootstrap version CSS
  cookie_name: 'cookie_consent' # name of cookie with timestamp of consent
  cookie_age: 365 # cookie expiration in days
  cookie_refresh: true # refresh consent cookie upon each request

Prefab CSS inclusion can be blocked altogether from _config.php:

Requirements::block('restruct/silverstripe-cookiebar:client/dist/css/cookiebar.css');

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •