You are here

function shadowbox_get_settings in Shadowbox 6.3

Same name and namespace in other branches
  1. 5.2 shadowbox.module \shadowbox_get_settings()
  2. 5 shadowbox.module \shadowbox_get_settings()
  3. 6.4 shadowbox.module \shadowbox_get_settings()
  4. 6.2 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 441
Shadowbox, a JavaScript media viewer application for displaying content in a modal dialogue.

Code

function shadowbox_get_settings($override = array()) {
  global $language;
  $players = array();
  if (shadowbox_media_support('images')) {
    $players[] = 'img';
  }
  if (shadowbox_media_support('swf')) {
    $players[] = 'swf';
  }
  if (shadowbox_media_support('flv')) {
    $players[] = 'flv';
  }
  if (shadowbox_media_support('quicktime')) {
    $players[] = 'qt';
  }
  if (shadowbox_media_support('wmp') || shadowbox_media_support('qtwmp')) {
    $players[] = 'wmp';
  }
  if (shadowbox_media_support('iframe')) {
    $players[] = 'html';
    $players[] = 'iframe';
  }
  $settings = array(
    'animate' => variable_get('shadowbox_animate', TRUE),
    'animateFade' => variable_get('shadowbox_animate_fade', TRUE),
    'animSequence' => variable_get('shadowbox_animation_sequence', 'wh'),
    'auto_enable_all_images' => variable_get('shadowbox_auto_enable_all_images', 0),
    'auto_gallery' => variable_get('shadowbox_auto_gallery', 0),
    'autoplayMovies' => variable_get('shadowbox_autoplay_movies', TRUE),
    'continuous' => variable_get('shadowbox_continuous_galleries', FALSE),
    'counterLimit' => variable_get('shadowbox_counter_limit', 10),
    'counterType' => variable_get('shadowbox_counter_type', 'default'),
    'displayCounter' => variable_get('shadowbox_display_counter', TRUE),
    'displayNav' => variable_get('shadowbox_display_nav', TRUE),
    'enableKeys' => variable_get('shadowbox_enable_keys', TRUE),
    'fadeDuration' => variable_get('shadowbox_fade_duration', 0.35),
    'handleOversize' => variable_get('shadowbox_handle_oversize', 'resize'),
    'handleUnsupported' => variable_get('shadowbox_handle_unsupported', 'link'),
    'initialHeight' => variable_get('shadowbox_initial_height', 160),
    'initialWidth' => variable_get('shadowbox_initial_width', 320),
    'language' => $language->language,
    'modal' => !variable_get('shadowbox_overlay_listen', TRUE),
    'overlayColor' => '#' . variable_get('shadowbox_overlay_color', '000'),
    'overlayOpacity' => variable_get('shadowbox_overlay_opacity', 0.8),
    'players' => $players,
    'resizeDuration' => variable_get('shadowbox_resize_duration', 0.55),
    'showMovieControls' => variable_get('shadowbox_show_movie_controls', TRUE),
    'slideshowDelay' => variable_get('shadowbox_slideshow_delay', 0),
    'viewportPadding' => variable_get('shadowbox_viewport_padding', 20),
    'useSizzle' => variable_get('shadowbox_use_sizzle', FALSE),
  );
  $settings = array_merge($settings, $override);
  $settings = array(
    'shadowbox' => $settings,
  );
  return $settings;
}