JavaScript Error - cookiesOverlay function called with wrong parameters

Created on 19 August 2025, 26 days ago

Problem/Motivation

The cookies_addons_fields module contains a JavaScript error in the fallback() function that prevents
proper cookie overlay display and causes console errors.

Steps to reproduce

1. Enable cookies_addons_fields module
2. Configure a field to use cookie service blocking
3. Visit a page with blocked content
4. Open browser developer console
5. Observe JavaScript error when overlay should be displayed

Proposed resolution

Fix line 36 in js/cookies-addons-fields.js:

Current (incorrect):
$(this).cookiesOverlay(service, serviceName);

Should be:
$(this).cookiesOverlay(service);

The cookiesOverlay function in cookies.lib.js only accepts one parameter (serviceId), but
cookies_addons_fields passes two parameters, causing the error.

Remaining tasks

- [ ] Update JavaScript function call to use correct parameter count
- [ ] Test overlay functionality works correctly
- [ ] Verify no console errors

User interface changes

None - this is a bug fix that restores intended functionality.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Active

Version

1.3

Component

Cookies Addons Fields

Created by

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

Comments & Activities

  • Issue created by @scontzen
  • 🇩🇪Germany guido_s Cologne

    That should be changed in the whole module instead of just the cookies_addons_fields module.
    Maybe the function changed in the past in the cookies module? Not sure, but you are correct. serviceId is the only expected parameter.

  • You're absolutely right! I've reviewed the entire cookies_addons codebase and found this issue exists across multiple submodules:

    - cookies_addons_blocks: cookiesOverlay(service, serviceName)
    - cookies_addons_fields: cookiesOverlay(service, serviceName)
    - cookies_addons_views: cookiesOverlay(service, serviceName)
    - cookies_addons_paragraphs: cookiesOverlay(service, serviceName)

    So you're correct - this needs to be fixed across the entire cookies_addons module, not just in cookies_addons_fields. All four modules with the two-parameter calls need to be updated to use the single-parameter version to match the current function definition in the core cookies module.

  • @scontzen opened merge request.
  • 🇩🇪Germany guido_s Cologne

    I also just tested it in a fresh Drupal 11.2.3 site and can confirm it is still working as expected and placeholders are properly replaced with the actual content.
    As Igor also approved it, I'll merge it.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024