function js_injector_init in JS injector 6
Same name and namespace in other branches
- 6.2 js_injector.module \js_injector_init()
- 7.2 js_injector.module \js_injector_init()
- 7 js_injector.module \js_injector_init()
Implementation of hook_init(). Checks to see whether any js files should be added to the current page, based on rules configured by the site administrator.
File
- ./
js_injector.module, line 32 - Allows administrators to inject js into the page output based on configurable rules. Useful for adding simple js tweaks without modifying a site's official theme.
Code
function js_injector_init() {
$js_rules = _js_injector_load_rule();
foreach ($js_rules as $js_rule) {
if (_js_injector_evaluate_rule($js_rule)) {
drupal_add_js(file_create_path($js_rule['file_path']), 'module', $js_rule['scope'], FALSE, $js_rule['cache'], $js_rule['preprocess']);
}
}
}