function shadowbox_construct_header in Shadowbox 6.3
Same name and namespace in other branches
- 5.2 shadowbox.module \shadowbox_construct_header()
- 5 shadowbox.module \shadowbox_construct_header()
- 6.4 shadowbox.module \shadowbox_construct_header()
- 6.2 shadowbox.module \shadowbox_construct_header()
Build the Shadowbox header by adding the necessary CSS and JS files.
1 call to shadowbox_construct_header()
- shadowbox_init in ./
shadowbox.module - Implementation of hook_init().
File
- ./
shadowbox.module, line 349 - Shadowbox, a JavaScript media viewer application for displaying content in a modal dialogue.
Code
function shadowbox_construct_header() {
global $language;
if (shadowbox_active() && variable_get('shadowbox_enabled', TRUE)) {
// Add the base files.
shadowbox_library_add_js('shadowbox.js');
shadowbox_library_add_js('adapters/shadowbox-jquery.js');
shadowbox_library_add_css('shadowbox.css');
$shadowbox_location = variable_get('shadowbox_location', SHADOWBOX_DEFAULT_PATH);
// Add the language file.
$language_file = "{$shadowbox_location}/languages/shadowbox-{$language->language}.js";
if (file_exists($language_file)) {
drupal_add_js($language_file);
}
else {
// If a language file doesn't exist, default to English.
shadowbox_library_add_js('languages/shadowbox-en.js');
}
// Add the "player" files.
if (shadowbox_media_support('images')) {
shadowbox_library_add_js('players/shadowbox-img.js');
}
if (shadowbox_media_support('swf')) {
shadowbox_library_add_js('players/shadowbox-swf.js');
}
if (shadowbox_media_support('flv')) {
shadowbox_library_add_js('players/shadowbox-flv.js');
}
if (shadowbox_media_support('quicktime')) {
shadowbox_library_add_js('players/shadowbox-qt.js');
}
if (shadowbox_media_support('wmp') || shadowbox_media_support('qtwmp')) {
shadowbox_library_add_js('players/shadowbox-wmp.js');
}
if (shadowbox_media_support('iframe')) {
shadowbox_library_add_js('players/shadowbox-html.js');
shadowbox_library_add_js('players/shadowbox-iframe.js');
}
// Print the JavaScript settings to the page.
drupal_add_js(shadowbox_get_settings(), 'setting');
// Add the automatic image handling.
shadowbox_add_js('shadowbox_auto.js');
// Initialize Shadowbox.
drupal_add_js('
Shadowbox.path = "' . base_path() . $shadowbox_location . '/";
Shadowbox.init(Drupal.settings.shadowbox);
', 'inline', 'footer');
shadowbox_add_css('shadowbox.css');
}
}