Problem/Motivation
The cookies_addons_views module creates a compatibility issue with the viewsreference module that results in JavaScript errors.
Error encountered:
Uncaught TypeError: Cannot read properties of undefined (reading 'replace') at new Drupal.views.ajaxView (ajax_view.js:104-107)
Steps to reproduce
1. Install cookies_addons_views module
2. Install viewsreference module
3. Create a view with viewsreference fields that is restricted by cookies_addons
4. Visit the page with cookie restrictions active
5. Observe JavaScript error in browser console
Proposed resolution
In cookies_addons_views_views_pre_render(), after removing the views AJAX settings, also remove the #viewsreference marker to prevent viewsreference from adding problematic settings.
Remaining tasks
- Apply the proposed fix to cookies_addons_views module
- Test with various viewsreference configurations
User interface changes
None - this is a bug fix that maintains existing functionality.
API changes
None - the changes are internal to the module's behavior.
Data model changes
None - this only affects JavaScript behavior and AJAX handling.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | cookies_addons-viewsreference-support-fix-3545098-3.patch | 728 bytes | scontzen |
Issue fork cookies_addons-3545098
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
scontzen commentedComment #4
scontzen commentedCreated a PR and attached a patch with the changes for easy testing.
Comment #5
igor mashevskyi commentedComment #7
guido_sI also just tested it with the viewsreference module and also with the views_field_formatter module and enabled ajax in the view.
Without the new code I can reproduce the ajax error in the console and I can confirm the code fixes it and the view was working fine after clicking the consent button.
I also added the if clause that Ihor also noticed it was missing.
So I think we can merge this now.
Comment #9
guido_s