Skip to content

Instantly share code, notes, and snippets.

@steffenr
Last active October 10, 2015 11:28
Show Gist options
  • Save steffenr/3683375 to your computer and use it in GitHub Desktop.
Save steffenr/3683375 to your computer and use it in GitHub Desktop.
update jQuery Version in Drupal 7 for specific site
<?php
function MYMODULE_js_alter(&$javascript) {
// check if we are on front_page
if(drupal_is_front_page()) {
$path = drupal_get_path('module', 'MYMODULE') . '/js/jquery-1.7.1.min.js';
// Copy the current jQuery file settings and change
$javascript[$path] = $javascript['misc/jquery.js'];
// Update necessary settings
$javascript[$path]['version'] = '1.7.1';
$javascript[$path]['data'] = $path;
// Finally remove the original jQuery
unset($javascript['misc/jquery.js']);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment