Closed (duplicate)
Project:
jQuery Update
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Aug 2010 at 17:50 UTC
Updated:
5 Sep 2013 at 15:21 UTC
I used to include javascript files inside .tpl files by adding
drupal_add_js(drupal_get_path('theme', 'mytheme') . '/myscript.js');
$scripts = drupal_get_js();
, before print $scripts; this stops jquery update from working.
Comments
Comment #1
brewern commentedSubscribing
Comment #2
bibo commentedsubscribe
Comment #3
robloachThat's some ugly code you have there. Try adding the script in a small custom module's hook_init(), or earlier on in the rendering process, like in template.php or something.
Comment #4
stackpr commentedThis module does not actually modify the scripts as you call drupal_add_js. Instead, it modifies a copy of the array before building the $script variable at the preprocess_page step (jquery_update_preprocess_page). Since it is modifying a copy of the array, an additional call to drupal_get_js() is unaware of the changes.
#3 is right about trying to push the code earlier in the execution so this module (and others) can operate on the script.
However, with a deadline looming, you might try a custom JS scope like this (very hack-ish):
Comment #5
ionmedia commentedand what we can do with
jquery_ui_add(array("ui.dialog", "ui.progressbar", "ui.sortable"));?Comment #6
kenorb commented#965680: jquery_update_preprocess_page() overwrite $variables['scripts']
#426764: Allow other modules to alter the replacements