Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The API (post/preStatusLoad, etc) appears to be broken. At the very least I couldn't trigger a code snippet in a second module when a state trigger fired.
Steps to reproduce
1. Create a module with this script:
(function (Drupal) {
'use strict';
let PreStatusLoadHandler = function (response) {
console.log(response);
window.cookieResponse = response;
};
Drupal.eu_cookie_compliance('PreStatusLoad', PreStatusLoadHandler);
} (Drupal));
2. Reload the page and examine the console.
3. Note that the expected function caused no console output.
Issue fork eu_cookie_compliance-3310691
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
Grayle CreditAttribution: Grayle at Dropsolid commentedAPI might be ripe for removal, it was added to facilitate integration with other modules, but those other modules are now just reading the cookie directly anyway. And it's hard to understand how it works as well, so maintaining it has become a chore.
So maybe we can remove it instead. Of course, we don't know if someone out there is actually using the API. But seeing as it's fully broken, and nobody but the maintainer noticed...
Comment #3
svenryen CreditAttribution: svenryen at Ramsalt Lab commentedIt's not broken after all. It was caused by an error in the documentation. The two first events were given with a capital leading character (and I happened to pick the first event name when I set up the test), whereas the API expects lowercase for the first character. After changing my testing snippet from
PreStatusLoad
topreStatusLoad
it worked like a charm.Like you say, somebody might be using it, and we have been "yelled at" before for removing or changing functionality, so I'm a bit vary of removing something already added.
I'll commit a small patch to update documentation and this should be good to go.
Comment #4
svenryen CreditAttribution: svenryen at Ramsalt Lab commentedComment #7
svenryen CreditAttribution: svenryen at Ramsalt Lab commentedComment #8
svenryen CreditAttribution: svenryen at Ramsalt Lab commented