Download the PHP package femundfilou/kirby-cookie-consent without Composer
On this page you can find all versions of the php package femundfilou/kirby-cookie-consent. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download femundfilou/kirby-cookie-consent
More information about femundfilou/kirby-cookie-consent
Files in femundfilou/kirby-cookie-consent
Package kirby-cookie-consent
Short Description Cookie Consent is a customizable, easy-to-use privacy consent plugin for Kirby CMS.
License
Homepage https://github.com/femundfilou/kirby-cookie-consent
Informations about the package kirby-cookie-consent
Cookie Consent
Cookie Consent is a customizable, easy-to-use Kirby CMS plugin that manages cookie consents.
Concept
Categories
Cookie Consent uses categories to group single policies (or cookies as you wish). Each category is an object with the following entries.
key | type | value |
---|---|---|
id |
string | unique string |
label |
string | Label visible to the user |
description |
string | Description visible to the user |
Policies
A policy needs to be created for each cookie or tool you wish to have user consent for. A policy in an object with the following entries.
key | type | value |
---|---|---|
id |
string | unique string |
label |
string | Label visible to the user |
description |
string | Description visible to the user |
category |
string | must match with an category id |
Installation
Via composer
Usage
-
Add the section to your
site.yml
to get an interface to provide policies and categories. - Add this snippet to the footer of your website.
Handling consent
You need the handle the initialisation of your scripts and tools after consent of a user yourself.
For this, you can use the CookieConsent.getUserConsent()
function to return the policy ids, the user has given consent to. After given consent, the site will reload.
Example
Javascript Methods
A global object is added to window. You can use it by calling CookieConsent
or window.CookieConsent
. The object exposes the following entries.
key | type | description |
---|---|---|
policies | array |
Return all possible policy ids |
getUserConsent | function |
Returns an array of policy ids, the user has consented to |
openSettings | function |
Opens the settings page. |
Configuration
You can override the default configuration in your site/config/config.php
or on the snippet itself. The following options are provided:
name | type | default | possible values | description |
---|---|---|---|---|
locale | string | 'en' |
'en' , 'de' |
Language used in the cookie banner. You can also add your own translation |
expires | number | 365 |
any integer | Number in days, the cookie banner shows up again. |
position | string | 'bottom-right' |
'center' , 'bottom-right' |
Position of banner. |
blockPage | boolean | false |
true , false |
Adds a layer to block interaction with the page. |
autoIncludeJs | boolean | true |
true , false |
Automatically add necessary javascript assets. |
Overwrite in config.php
Overwrite on snippet
Overwriting or adding translations
Out of the box this plugin provides support for German and English translations. You may overwrite them or add other languages. Look at the kirby docs for more info about how to add custom language variables.
The following variables are provided:
Styling
Cookie Consent uses CSS Variables. You can overwrite them in your styles.
Example overwrite in css
Example overwrite in scss
Be sure to use #{$sassVariable}
to use scss variables in css variables.