kirby-cookie-banner
kirby-cookie-banner copied to clipboard
A Cookie Consent Modal for Kirby
A Cookie Consent Modal for Kirby3
Commercial Usage
This plugin is free but if you use it in a commercial project please consider to
Installation
- unzip master.zip as
folder
site/plugins/kirby3-cookie-banner
or -
git submodule add https://github.com/michnhokn/kirby3-cookie-banner.git site/plugins/kirby3-cookie-banner
or -
composer require michnhokn/kirby3-cookie-banner
Features
- Add a custom cookie consent modal
- Fully translatable.
- Intercept cookie status
- PHP functions to check for allowed features
For more features check out the wiki.
Setup
- Put the
cookie-modal
snippet right before the closing body tag.<?php snippet('cookie-modal', [ 'assets' => true, 'showOnFirst' => true, 'features' => [...], ]) ?>
- Set up your features for the cookie modal.
return [ 'michnhokn.cookie-banner' => [ 'features' => [ 'analytics' => 'Analytics', 'mapbox' => 'Mapbox' ] ] ];
- Listen for the
cookied:saved
event and receive anarray
of allowed features.u('body').on('cookies:saved', event => { console.log('Saved cookie features:', event.detail); })
Learn more in the wiki.
Methods
See all available functions in the wiki.
Misc
Roadmap: Have a look at this project.
License: MIT
Credits: MichnHokn