Hi I create this issue for other people facing this problem/mistake. I think a solution in code is possible but I just didn't read the cookiebot settings well enough.

What's the problem:

The cookiebot declaration shows up in each views row in a view with nodes.
Or when you'r domain isn't configured the generated message shows up for each row:
The domain YOURDOMAIN.COM is not authorized to show the cookie declaration. Please add it in the cookie manager to authorize the domain.

Quick Solution:

Make sure you're cookiebot settings configuration is one of the following:
- check 'Show the Cookiebot cookie declaration" and fill in the "Node page title"
- don't check and don't fill in

How is it caused:

- In the cookiebot settings mark the checkbox 'Show the Cookiebot cookie declaration'
- But don't fill in the 'Node page title' field.
- create a drupal view with nodes.

What's happening:

In cookiebot_node_view_alter() the cookiebot declaration is added to the node that should be configured in the cookiebot settings. But when the node isn't configured the $declaration_node_path is "/node/". At the same time, we are in a node while not on a node path (we are on a view) so $current_alias is also "/node/".
That means that for each viewsrow with a node the comparison $current_alias === $declaration_node_path will be TRUE and the cookiebot declaration will be inserted.

Suggestions to solve this in code

- adding a check in the form validation
- in cookiebot_node_view_alter test if it's really a node page and not another page, like a view.

Issue fork cookiebot-3055103

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

Floris Vedder created an issue. See original summary.

a.milkovsky’s picture

Hi Floris, thank you for the report.
We should indeed add some validation. If you have a patch for it, I am happy to commit it.

matthijs’s picture

Version: 8.x-1.0-alpha5 » 8.x-1.x-dev
Component: User interface » Code
Priority: Minor » Normal

matthijs’s picture

Status: Active » Needs review
bramdriesen’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

Merge request needs to be rebased.

jmaerckaert’s picture

I provide a patch for the version 8.x-1.0-alpha13.

jmaerckaert’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 7: cookiebot-declaration-shows-op-in-each-views-row-when-node-page-title-not-set-3055103-7.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.