function hook_js_alter

7.x system.api.php hook_js_alter(&$javascript)
8.x system.api.php hook_js_alter(&$javascript)

Perform necessary alterations to the JavaScript before it is presented on the page.


$javascript: An array of all JavaScript being presented on the page.

See also




Related topics

2 functions implement hook_js_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

locale_js_alter in drupal/modules/locale/locale.module
Implements hook_js_alter().
simpletest_js_alter in drupal/modules/simpletest/simpletest.module
Implements hook_js_alter().
1 invocation of hook_js_alter()
drupal_get_js in drupal/includes/
Returns a themed presentation of all JavaScript code for the current page.


drupal/modules/system/system.api.php, line 746
Hooks provided by Drupal core and the System module.


function hook_js_alter(&$javascript) {
  // Swap out jQuery to use an updated version of the library.
  $javascript['misc/jquery.js']['data'] = drupal_get_path('module', 'jquery_update') . '/jquery.js';