Created
February 20, 2013 07:01
-
-
Save zachharkey/4993530 to your computer and use it in GitHub Desktop.
Drupal 7 Using Newer Versions of jQuery on certain pages
Method 4: Swapping jquery with preprocess page http://drupal.org/node/1058168
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function MYTHEME_preprocess_page(&$variables) { | |
// exclude backend pages to avoid core js not working anymore | |
// you could also just use a backend theme to avoid this | |
if (arg(0) != 'admin' || !(arg(1) == 'add' && arg(2) == 'edit') || arg(0) != 'panels' || arg(0) != 'ctools') { | |
$scripts = drupal_add_js(); | |
$new_jquery = array(drupal_get_path('theme', 'YOURTHEME') . '/js/jquery-1.7.1.min.js' => $scripts['core']['misc/jquery.js']); | |
$scripts['core'] = array_merge($new_jquery, $scripts['core']); | |
unset($scripts['core']['misc/jquery.js']); | |
$variables['scripts'] = drupal_get_js('header', $scripts); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment