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.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | cookiebot-declaration-shows-op-in-each-views-row-when-node-page-title-not-set-3055103-7.patch | 2.75 KB | jmaerckaert |
Issue fork cookiebot-3055103
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
Comment #2
a.milkovskyHi 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.
Comment #3
matthijsComment #5
matthijsComment #6
bramdriesenMerge request needs to be rebased.
Comment #7
jmaerckaert commentedI provide a patch for the version 8.x-1.0-alpha13.
Comment #8
jmaerckaert commented