You are here

function shadowbox_get_settings in Shadowbox 5

Same name and namespace in other branches
  1. 5.2 shadowbox.module \shadowbox_get_settings()
  2. 6.4 shadowbox.module \shadowbox_get_settings()
  3. 6.2 shadowbox.module \shadowbox_get_settings()
  4. 6.3 shadowbox.module \shadowbox_get_settings()

Construct the JS settings array.

Parameters

$override: An array of settings to override global values.

Return value

An array containing settings to be used in drupal_add_js.

1 call to shadowbox_get_settings()
shadowbox_construct_header in ./shadowbox.module
Build the Shadowbox header by adding the necessary CSS and JS files.

File

./shadowbox.module, line 688
Shadowbox, a JavaScript media viewer application for displaying content in a modal dialogue.

Code

function shadowbox_get_settings($override = array()) {
  $module_path = drupal_get_path('module', 'shadowbox');
  $images = variable_get('shadowbox_supported_images', shadowbox_get_types('image'));
  $quicktime = variable_get('shadowbox_supported_quicktime', shadowbox_get_types('quicktime'));
  $wmp = variable_get('shadowbox_supported_wmp', shadowbox_get_types('wmp'));
  $qtwmp = variable_get('shadowbox_supported_qtwmp', shadowbox_get_types('qtwmp'));
  $iframe = variable_get('shadowbox_supported_iframe', shadowbox_get_types('iframe'));
  $settings = array(
    'asset_url' => base_path() . variable_get('shadowbox_asset_url', $module_path . '/shadowbox') . '/',
    'loading_image' => variable_get('shadowbox_loading_image', 'images/loading.gif'),
    'animation' => variable_get('shadowbox_animate', TRUE),
    'animation_sequence' => variable_get('shadowbox_animation_sequence', 'wh'),
    'overlay_color' => variable_get('shadowbox_overlay_color', '000'),
    'overlay_opacity' => variable_get('shadowbox_overlay_opacity', 0.85),
    'overlay_listen' => variable_get('shadowbox_overlay_listen', TRUE),
    'resize_duration' => variable_get('shadowbox_resize_duration', 0.35),
    'fade_duration' => variable_get('shadowbox_fade_duration', 0.35),
    'display_nav' => variable_get('shadowbox_display_nav', TRUE),
    'flv_player' => variable_get('shadowbox_flv_player', 'flvplayer.swf'),
    'background_image' => variable_get('shadowbox_background_image', 'images/overlay-85.png'),
    'autoplay_movies' => variable_get('shadowbox_autoplay_movies', TRUE),
    'show_movie_controls' => variable_get('shadowbox_show_movie_controls', TRUE),
    'continuous_galleries' => variable_get('shadowbox_continuous_galleries', FALSE),
    'display_counter' => variable_get('shadowbox_display_counter', TRUE),
    'counter_type' => variable_get('shadowbox_counter_type', 'default'),
    'viewport_padding' => variable_get('shadowbox_viewport_padding', 20),
    'initial_height' => variable_get('shadowbox_initial_height', 160),
    'initial_width' => variable_get('shadowbox_initial_width', 320),
    'enable_keys' => variable_get('shadowbox_enable_keys', TRUE),
    'keys_close' => _explode_to_int(variable_get('shadowbox_keys_close', 'c q 27')),
    'keys_previous' => _explode_to_int(variable_get('shadowbox_keys_previous', 'p 37')),
    'keys_next' => _explode_to_int(variable_get('shadowbox_keys_next', 'n 39')),
    'handle_large_images' => variable_get('shadowbox_handle_large_images', 'resize'),
    'handle_unsupported' => variable_get('shadowbox_handle_unsupported', 'link'),
    'extensions_img' => _array_to_string_values($images),
    'extensions_qt' => _array_to_string_values($quicktime),
    'extensions_wmp' => _array_to_string_values($wmp),
    'extensions_qtwmp' => _array_to_string_values($qtwmp),
    'extensions_iframe' => _array_to_string_values($iframe),
    'text_cancel' => t('Cancel'),
    'text_loading' => t('Loading'),
    'text_close' => t('Close'),
    'text_next' => t('Next'),
    'text_previous' => t('Previous'),
    'errors_single' => t('You must install the <a href="{0}">{1}</a> browser plugin to view this content.'),
    'errors_shared' => t('You must install both the <a href="{0}">{1}</a> and <a href="{2}">{3}</a> browser plugins to view this content.'),
    'errors_either' => t('You must install either the <a href="{0}">{1}</a> or the <a href="{2}">{3}</a> browser plugin to view this content.'),
  );
  $settings = array_merge($settings, $override);
  $settings = array(
    'shadowbox' => $settings,
  );
  return $settings;
}