i would like to remove a .js file from a drupal module to override this .js one in my theme.
So, in my MYTHEME_preprocess_page() function I added the following code:
//Delete logintoboggan.js and replace by our own in .info file
$tmpJs = drupal_add_js();
if (isset($tmpJs['module']['sites/all/modules/logintoboggan/logintoboggan.js'])) unset($tmpJs['module']['sites/all/modules/logintoboggan/logintoboggan.js']);
$vars['scripts'] = drupal_get_js($tmpJs);
This for, but a warning message appear on the website:
warning: Illegal offset type in isset or empty in /home/mykitxen/public_html/example.com/includes/common.inc on line 2210.
What is wrong?
You’re missing the first parameter of
drupal_get_js()($scope), which should be'header'orNULLin your case (with NULL just triggering the default'header'). So the last line of your code should be:or
NOTE: This assumes Drupal 6. If you are using Drupal 7, you might want to take a look at
hook_js_alter().