JU and JS Alter both operate on the original, unaltered set of scripts, which causes JU to revert any changes made by JS Alter. However, we can easily support jsalter by changing the last line of jquery_update_preprocess_page() from
$variables['scripts'] = drupal_get_js('header', $scripts);
to
// If installed, let jsalter.module alter the result.
$function = module_exists('jsalter') ? 'jsalter_get_js' : 'drupal_get_js';
$variables['scripts'] = $function('header', $scripts);
thus restoring the functionality of JS Alter which some modules rely on.
Comments
Comment #1
sammys commentedHi,
I've stumbled on the same problem. While your suggested solution would work it will unfortunately run the jsalter code twice. Once for jquery_update_preprocess_page() and once for jsalter_preprocess_page(). This is VERY undesirable.
Instead of using your solution I've rolled a potential patch that will save that extra step. It simply means jquery_update implements hook_js_alter(). :)
The patch applies to alpha1. Will happily reroll if it doesn't apply to 2.x-dev.
Comment #2
sun#1 makes sense, but needs some clean-up and also docs. Additionally, this patch or #858578: Errors due to changed order of scripts needs to be re-rolled after one of both landed.
Comment #3
pacufist commentedHi guys! Do you have any progress ?
Comment #4
robloachIf you do an update from yesterday in 6.x-2.x-dev, you'll see there's a hook_jquery_update_alter(). Probably needs some documentation fixing though.
Comment #5
pacufist commentedThanks! I`s exactly what I need.
Comment #7
shark commentedCan someone provide a tiny example on how to use this? Is anything required beyond implementing hook_js_alter?
Thanks!