function itoggle_include_itoggle in iToggle 7.2
Same name and namespace in other branches
- 7 includes/itoggle.inc \itoggle_include_itoggle()
Include iToggle css and javascript files.
Parameters
boolean: Whether we are just including iToggle scripts or also our own settings and script.
1 call to itoggle_include_itoggle()
- itoggle_preprocess_itoggle in ./
itoggle.theme.inc - Implements hook_preprocess_hook().
File
- ./
itoggle.module, line 207 - iToggle core module.
Code
function itoggle_include_itoggle($settings = TRUE) {
static $css_added = FALSE;
static $lib_added = FALSE;
static $js_added = FALSE;
// @TODO define library and include via libraries api
// @TODO define css as part of library
// Add iToggle default CSS.
if (!$css_added && variable_get('itoggle_css', TRUE)) {
drupal_add_css(drupal_get_path('module', 'itoggle') . '/misc/itoggle.css');
$css_added = TRUE;
}
// Add iToggle library.
if (!$lib_added) {
$filename = 'itoggle';
if (module_exists('jquery_update')) {
if (version_compare(variable_get('jquery_update_jquery_version', '1.5'), '1.7', '>=')) {
$filename .= '-1.7';
}
}
if (($type = variable_get('itoggle_compression_type', 'min')) == 'min') {
$filename .= '.min';
}
drupal_add_js(drupal_get_path('module', 'itoggle') . "/misc/{$filename}.js", array(
'group' => JS_LIBRARY,
'weight' => 1,
));
$lib_added = TRUE;
}
// Add iToggle default JavaScript and settings.
if ($settings === TRUE) {
itoggle_include_settings();
if (!$js_added) {
drupal_add_js(drupal_get_path('module', 'itoggle') . '/misc/itoggle.drupal.js', array(
'group' => JS_THEME,
));
$js_added = TRUE;
}
}
}