Support placeholder message and button text customisation with data attributes

Created on 19 February 2024, 10 months ago
Updated 9 April 2024, 9 months ago

Problem/Motivation

Currently the text and button are hardcoded to always display the same text. We could change these to come from the module settings.

Also currently the button is suggesting that the cookies can be approved just by clicking on the button when actually it is opening the cookie popup. We should change the default text to be more clear.

Steps to reproduce

NA.

Proposed resolution

Allow developers to define the blocked content title, message and button text with the following data attributes
* data-placeholder-title
* data-placeholder-text
* data-placeholder-button-text

At the same time we could allow the customisation of data-category-consent from the iframe itself and only set the default value when it's not defined.

Remaining tasks

1. Add the JS functionality to https://git.drupalcode.org/project/cookieinformation/-/blob/2.1.x/js/ifr... to read the allowed data attributes.
2. Sanitize the data attribute as strings.
3. Document the new feature to readme.

User interface changes

None.

API changes

None.

Data model changes

None.

Feature request
Status

Active

Version

2.1

Component

Code

Created by

🇫🇮Finland heikkiy Oulu

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024