1

I have the jQuery Update's development shapshot version 7.x-2.x-dev installed and enabled. The version jQuery configured in UI is not being imported. As result, it is importing version 1.4.4 instead of the version I specified. Debugging, I noticed that jquery_update_library_alter() is not being called. In meanwhile, my custom hook_library_alter() is called, and I use that as temporary solution until I figure out why the hook implemented by the jQuery Update module is not called.

function MODULE-NAME_library_alter(&$javascript, $module) {
  module_load_include('module', 'jquery_update');
  jquery_update_library_alter($javascript, $module);
}

This is first time I encounter a situation where hooks are not called. Where are hooks attached to and where are they called from? How would you approach to troubleshoot hooks? Where can I check all registered hooks?

1 Answer 1

1

I had this problem as well and I tracked it down to a custom module calling drupal_add_js() right at the top of the module file. This meant that drupal_get_library(system, jquery) and in turn module_implements(library_alter) were getting called before the jquery_update.module file had a chance to get loaded and hence jquery_update_library_alter wasn't defined yet.

To find this I put the following lines into drupal/include/module.inc and cleared the cache.

...
function module_implements($hook, $sort = FALSE, $reset = FALSE) {
    if ($hook == 'library_alter') { debug_print_backtrace(); exit; }
...

You might have some other problem, but a call to drupal_add_js to early in execution was my issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.