function _labjs_replace_javascript in LABjs 6
Replace JavaScripts in $javascript.
Parameters
array $replacement: Each element is a keyed array with 3 values: region, old, new.
Example: to replace the core misc/drupal.js _labjs_replace_javascript($javascript, array(array('region' => 'core', 'old' => 'misc/drupal.js', 'new' => 'myscript.js')));
1 call to _labjs_replace_javascript()
- _labjs_patch_core in ./
labjs.module - Replace core JavaScripts with LABjs-aware version.
File
- ./
labjs.module, line 271 - LABjs module
Code
function _labjs_replace_javascript(&$javascript, $replacement) {
foreach ($replacement as $item) {
if (isset($javascript[$item['region']][$item['old']])) {
$keys = array_keys($javascript[$item['region']]);
$values = array_values($javascript[$item['region']]);
$position = array_search($item['old'], array_keys($javascript[$item['region']]));
$keys[$position] = $item['new'];
$javascript[$item['region']] = array_combine($keys, $values);
// PHP5
}
}
}