Problem/Motivation

As a webmaster I want to be able to easily add the Cookiebot declaration into a formatted text.

Proposed resolution

Add a filter plugin that is replaced with the Cookiebot JavaScript.

CommentFileSizeAuthor
#2 3171592_2.patch11.62 KBmpp

Issue fork cookiebot-3171592

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mpp created an issue. See original summary.

mpp’s picture

Status: Active » Needs review
StatusFileSize
new11.62 KB

Patch by zero2one.

Status: Needs review » Needs work

The last submitted patch, 2: 3171592_2.patch, failed testing. View results

mpp’s picture

With CKeditor 5 the patch in #2 results in an error CKEditor 5 only works with HTML-based text formats. The "Replace Cookiebot declaration placeholder" (filter_cookiebot_declaration) filter implies this text format is not HTML anymore.

Replaced the FilterInterface::TYPE_MARKUP_LANGUAGE with FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE.

wim leers’s picture

Issue tags: +ddd2022

#5 is correct!

See \Drupal\filter\Plugin\FilterInterface's docs. Similar ones: https://www.drupal.org/project/adsense, https://www.drupal.org/project/entity_embed, https://www.drupal.org/project/token_filter, et cetera.

p-neyens made their first commit to this issue’s fork.

flyke’s picture

I just wanted to note that MR5 applies to D11.2.8. It adds a filter you can enable for text format and editors, and when enabled, if you place '[COOKIEBOT_DECLARATION]' inside your text, it will effectively be replaced with the cookie declaration.

For me it all seems to work, so is it ok to set the status to reviewed and tested by the community ?