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
After invoke command ctools_modal_form_wrapper() on ajax response, Drupal attaches js behaviors for the whole document, instead of modal dialog. This causes duplicetes of ajax events for all selectors that uses context variable.
Example
$('.my-button', context).click(function() {
console.log('I am invoked');
});
When page is loaded, click on this button will log only one message. But after modal dialog was invoked, the same click event will write in console two debug messages. After one more ajax response with modal dialog we will see three messages in console, etc.
Proposed solution
Add correct context for Drupal.attachBehaviors after modal context was invoked. Patch is attached.
Comments
Comment #1
SpleshkaRemoved extra spaces.
Comment #2
duozerskYup, looks pretty clear and straight forward fix to me.
Comment #3
SpleshkaAny progress here? Patch is almost obvious.
Comment #4
SpleshkaStill no progress? :(
Comment #5
podarok#1 looks good for me
let`s make it pushed
Comment #6
japerryFixed and Committed:
http://drupalcode.org/project/ctools.git/commit/4f27a07906ef85758e14ccd3...