restruct/silverstripe-cookiebar

Drop-in configurable notice about cookies

Installs: 360

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 4

Forks: 0

Open Issues: 0

Type:silverstripe-vendormodule

2.2.4 2025-09-25 10:16 UTC

This package is auto-updated.

Last update: 2025-09-25 10:20:44 UTC


README

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');