MarkupCookieConsent by can

Renders cookie consent information for EU-Cookie-Law

MarkupCookieConsent

Requires


ProcessWire >= 2.8.15 Haven't tested it myself on pw 2.8, and actually don't even know if there is 2.8.15. Thing is, it depends on this fix which was applied right before pw 3.0.16.

NOTE!


This repo now includes a devns branch. Which is not a development version of this module, but rather meant to be used with Processwire 3.x devns as the only difference is the added namespace and therefore the requires flag in module info.

Still considered Beta


Not widely tested, and config inputs already look like they're translatable but they're actually not yet saving! Thanks to Ryan the newest PW 3.0.15 devns fixes this issue

Problems with cookies not being set?


Make sure to remember any settings! Please remove module and then install fresh copy of newest version. Or update to latest version, then disable and enable module.

Info about non-minified CSS & JS


The module only checks for minified style and script so if you make any changes either minify yourself and name file MarkupCookieConsent.min.css / MarkupCookieConsent.min.js or disable auto injection in settings and include them yourself So the non-minified versions are only for development. Minified CSS & JS have been added in version 0.1.2.

CSS customization


If you want to use your own stylesheet or merge MarkupCookieConsent styles with another stylesheet just uncheck moduleStyles. If you want to use a custom CSS class prefix you can modify it by adding the following code line to your ready.php.

$modules->get('MarkupCookieConsent')->classPrefix = 'CSSCustomPrefix';  

What it does


This module is intended to add a little cookie notice to your front-end. It's doing this by hooking into page render and altering the output to include the form at the end of the page (right before </body>).

Features


  • AJAX (deactivatable, JS disabled users will fall back to normal form submit with page reload, so fully functional without JS)
  • 2 themes (dark/light)
  • 2 positions (top/bottom)
  • customizable texts, message and button label
  • prepend / append custom text/markup to the button e.g. Font Awesome Icon like in the screenshot
  • selector field to limit banner to certain pages
  • customizable privacy policy - select page from your page tree or provide custom url (optional), change link text and target
  • fully customizable cookie settings (name, lifetime, domain, path, secure, HTTPonly)
  • you wanna roll your own design? Just disable default stylesheet

Installation


You can enter the class name MarkupCookieConsent in your back-ends module configs and it will download automatically or get from Processwires module directory or Github and install it by unzipping and moving into your /site/modules/ folder or selecting the zip from your back-ends modules page.

Changelog


  • 0.3.3 - CSS class prefix sustainably implemented, removed dependence between stylesheet-autoinjection and CSS classes
  • 0.3.2 - fix banner not showing on front end if no page selector provided
  • 0.3.0 - add display limit selector field to define limit the banner to certain pages, added "remove cookie" button, removed cookie path setting
  • 0.2.0 - fixed version issue and misleading cookie expiration setting
  • 0.1.6 - added custom privacy url as requested by kixe, fixed custom link target, appended query string "accept=cookies" to form action for cached non ajax requests
  • 0.1.5 - fixed issue on single language installations
  • 0.1.4 - Cookie notification now completely translatable in front-end
  • 0.1.2 - Added minified CSS & JS files
  • 0.1.1 - Fixed issue with cookie not being set, two strings wouldn't recognize translation, default cookie expire now 1 year, updated readme, removed deprecated branch
  • 0.1.0 - Missing strings now translatable
  • 0.0.9 - Changed style injection, now prepends to first in head makes it easier to add custom css tweaks without the need for !important because of the cascading order

Install and use modules at your own risk. Always have a site and database backup before installing new modules.

Latest news

  • ProcessWire Weekly #548
    In the 548th issue of ProcessWire Weekly we're going to check out a couple of new third party modules, introduce the latest ProcessWire core updates, and more. Read on!
    Weekly.pw / 9 November 2024
  • Custom Fields Module
    This week we look at a new ProFields module named Custom Fields. This module provides a way to rapidly build out ProcessWire fields that contain any number of subfields/properties within them.
    Blog / 30 August 2024
  • Subscribe to weekly ProcessWire news

“We chose ProcessWire because of its excellent architecture, modular extensibility and the internal API. The CMS offers the necessary flexibility and performance for such a complex website like superbude.de. ProcessWire offers options that are only available for larger systems, such as Drupal, and allows a much slimmer development process.” —xport communication GmbH