function javascript_libraries_preprocess_html in JavaScript Libraries Manager 7
Implements hook_preprocess_html().
File
- ./
javascript_libraries.module, line 188 - Toggle the inclusion of Drupal system libraries. Upload and reference custom libraries as well.
Code
function javascript_libraries_preprocess_html() {
if (user_access('view the administration theme') && path_is_admin(current_path())) {
// Don't load any custom JS when administrators are viewing an admin page.
return;
}
// Make sure jquery always loads.
drupal_add_library('system', 'jquery', TRUE);
$libraries = variable_get('javascript_libraries_drupal_libraries', array());
foreach ($libraries as $key => $info) {
if (is_array($info) && !empty($info['library']) && !empty($info['module'])) {
drupal_add_library($info['module'], $info['library']);
}
}
$custom = variable_get('javascript_libraries_custom_libraries', array());
$options = array();
$options['every_page'] = TRUE;
foreach ($custom as $library) {
if ($library['scope'] != 'disabled') {
javascript_libraries_add_js($library, $options);
}
}
}