1 system.api.php hook_js_alter(&$javascript)

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

Parameters

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

See also

backdrop_add_js()

backdrop_get_js()

backdrop_js_defaults()

Related topics

File

core/modules/system/system.api.php, line 297
Hooks provided by Backdrop core and the System module.

Code

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