Вот оно в новом модуле.Это скопировано и изменено из модуля jquery update .:
/**
* Implementation of hook_theme_registry_alter().
*
* Make my page preprocess function run *after* everything else's.
*/
function my_module_theme_registry_alter(&$theme_registry) {
if (isset($theme_registry['page'])) {
// If jquery_update's preprocess function is there already, remove it.
if ($key = array_search('jquery_update_preprocess_page', $theme_registry['page']['preprocess functions'])) {
unset($theme_registry['page']['preprocess functions'][$key]);
}
// Now tack it on at the end so it runs after everything else.
$theme_registry['page']['preprocess functions'][] = 'my_module_preprocess_page';
}
}
/**
* Implementation of moduleName_preprocess_hook().
*
* Replace Drupal core's jquery.js with the new one from my module.
*/
function my_module_preprocess_page(&$variables) {
// Only do this for a specific page.
$alias_array = explode('/', drupal_get_path_alias($_GET['q']));
if($alias_array[0] == 'special_page') {
// get the scripts from head.
$scripts = drupal_add_js();
$myreplacement = drupal_get_path('module', 'my_module').'/jquery-1.4.1.min.js';
$new_jquery = array($myreplacement => $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);
}
}
?>