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.
The javascript code breaks other AJAX fields like drag & drop for manage display or upload fields.
(function ($) {
Drupal.behaviors.views_hst_filter = {
attach: function(context, settings) {
for (ajax_object in Drupal.ajax) {
if (Drupal.ajax[ajax_object].options) {
jQuery.extend(Drupal.ajax[ajax_object].options.data, Drupal.settings.exposed_form_info);
}
}
}
};
})(jQuery);
Comment | File | Size | Author |
---|---|---|---|
#5 | views_hst_filter-js_extra_file_and_fix-1857868-5.patch | 1.52 KB | yannickoo |
#3 | views_hst_filter-javascript_break-1857868.patch | 664 bytes | ser_house |
Comments
Comment #1
ser_house CreditAttribution: ser_house commentedWhere this occurs?
Comment #2
yannickooE.g. node creation/edit page or manage display, after disabling the module it works fine.
Comment #3
ser_house CreditAttribution: ser_house commentedTest it, please:
Comment #4
yannickooCool, works fine but I think we should put that into an extra file so that it can be cached and please use single quotes instead of double quotes :)
Comment #5
yannickooComment #6
ser_house CreditAttribution: ser_house commentedYou're right. I made it.
Comment #7
Sk8erPeter CreditAttribution: Sk8erPeter commented+1 for yannickoo, I just wanted to ask the same, to keep it separately in a JS-file, because in this way, this is hard to maintain, and can not be cached, and simply generates an inline code.
Thanks for ser_house for applying the changes, and for yannickoo for creating the patch.
Comment #8
yannickooAnd you forgot to attribute authorship to me again ;)
Comment #9
ser_house CreditAttribution: ser_house commentedSorry, yannickoo, but I didn't use your patch because It is wrong.
When before?
Comment #10
yannickooThe issue with the code clean-up, doesn't matter. When doing javascript in Drupal you should use camelCase that is the reason why I replaced
ajax_object
withajaxObject
. And the line break before the if was for better reading.Comment #11
Sk8erPeter CreditAttribution: Sk8erPeter commented+1 for the camelCase. :D
The problem why it didn't work was here, you didn't change all the ajax_object keys to ajaxObject.
+ if (Drupal.ajax[ajaxObject].options) {
+ jQuery.extend(Drupal.ajax[ajax_object].options.data, Drupal.settings.exposed_form_info);
+ }
Comment #12
yannickooOh, my fault. I open a new issue and post a patch.
Comment #13
ser_house CreditAttribution: ser_house commentedYep, camelCase... Mea pulpa :) Corrected.
Comment #14
yannickooLet us wait for this issue so that we can remove the javascript later. That is also the reason why I didn't touch
exposed_form_info
which should be also camelcased.Comment #15
ser_house CreditAttribution: ser_house commented@yannickoo
In issue "Clean up" commit message: "Issue #1841548 by yannickoo: Clean up code."
What else? I think it is important.
Comment #16
yannickooYou're right and I cannot see it on my profile because this is still a sandbox, sorry.
Comment #17
barraponto CreditAttribution: barraponto commented@ser_house this is how you attribute patches: http://drupal.org/node/1146430
anyway, let's close #1183418: Ajax attached to exposed filters in form_alter doesn't trigger callback first.
Comment #18
barraponto CreditAttribution: barraponto commented@ser_house this is how you attribute patches: http://drupal.org/node/1146430
anyway, let's close #1183418: Ajax attached to exposed filters in form_alter doesn't trigger callback first.
Comment #19
yannickooWhy you want to close #1183418: Ajax attached to exposed filters in form_alter doesn't trigger callback? We have to wait until the patch from #33 is in Views then we have to remove that part from the Views Hst module because the functionality is in Views then.
Comment #20
barraponto CreditAttribution: barraponto commented@yannickoo that's what I meant. Let's [get the patch into RTBC and then finally commited with proper attribution and finally] close the issue :)