function _thickbox_doheader in Thickbox 6
Same name and namespace in other branches
- 5 thickbox.module \_thickbox_doheader()
Loads the various js and css files.
1 call to _thickbox_doheader()
- thickbox_init in ./
thickbox.module - Implementation of hook_init().
File
- ./
thickbox.module, line 96 - Author: Fredrik Jonsson fredrik at combonet dot se The thickbox module is a simple wrapper for the jquery plugin ThickBox http://jquery.com/demo/thickbox/.
Code
function _thickbox_doheader() {
global $user;
static $already_added = FALSE;
if ($already_added) {
return;
// Don't add the JavaScript and CSS multiple times.
}
if (!_thickbox_active()) {
return;
// Don't add the JavaScript and CSS on specified paths.
}
$path = drupal_get_path('module', 'thickbox');
drupal_add_css($path . '/thickbox.css');
if (variable_get('thickbox_ie_css', 0) != 1) {
drupal_add_css($path . '/thickbox_ie.css');
}
// Insert options and translated strings as javascript settings.
$js_settings = array(
'close' => t('Close'),
'next' => t('Next >'),
'prev' => t('< Prev'),
'esc_key' => t('or Esc Key'),
'next_close' => t('Next / Close on last'),
'image_count' => t('Image !current of !total'),
);
drupal_add_js(array(
'thickbox' => $js_settings,
), 'setting');
if ($user->uid == 0 && variable_get('thickbox_login', 0)) {
drupal_add_js($path . '/thickbox_login.js');
}
if (variable_get('thickbox_auto', 0) && module_exists('image')) {
drupal_add_js(array(
'thickbox' => array(
'derivative' => variable_get('thickbox_derivative', 'preview'),
),
), 'setting');
drupal_add_js($path . '/thickbox_auto.js');
}
drupal_add_js($path . '/thickbox.js');
$already_added = TRUE;
}