You are here

function _shadowbox_get_settings in Shadowbox 8

Same name and namespace in other branches
  1. 7.4 shadowbox.module \_shadowbox_get_settings()
  2. 7.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.

1 call to _shadowbox_get_settings()
shadowbox_library_alter in ./shadowbox.module
Implements hook_library_alter().

File

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

Code

function _shadowbox_get_settings($override = array()) {
  $config = \Drupal::config('shadowbox.settings');
  $config_automatic = \Drupal::config('shadowbox.automatic');
  $settings = array(
    'animate' => $config
      ->get('shadowbox_animate'),
    'animateFade' => $config
      ->get('shadowbox_animate_fade'),
    'animSequence' => $config
      ->get('shadowbox_animation_sequence'),
    'auto_enable_all_images' => $config_automatic
      ->get('shadowbox_auto_enable_all_images'),
    'auto_gallery' => $config_automatic
      ->get('shadowbox_auto_gallery'),
    'autoplayMovies' => $config
      ->get('shadowbox_autoplay_movies'),
    'continuous' => $config
      ->get('shadowbox_continuous_galleries'),
    'counterLimit' => $config
      ->get('shadowbox_counter_limit'),
    'counterType' => $config
      ->get('shadowbox_counter_type'),
    'displayCounter' => $config
      ->get('shadowbox_display_counter'),
    'displayNav' => $config
      ->get('shadowbox_display_nav'),
    'enableKeys' => $config
      ->get('shadowbox_enable_keys'),
    'fadeDuration' => $config
      ->get('shadowbox_fade_duration'),
    'handleOversize' => $config
      ->get('shadowbox_handle_oversize'),
    'handleUnsupported' => $config
      ->get('shadowbox_handle_unsupported'),
    'initialHeight' => $config
      ->get('shadowbox_initial_height'),
    'initialWidth' => $config
      ->get('shadowbox_initial_width'),
    'modal' => $config
      ->get('shadowbox_overlay_listen'),
    'overlayColor' => '#' . $config
      ->get('shadowbox_overlay_color'),
    'overlayOpacity' => $config
      ->get('shadowbox_overlay_opacity'),
    'resizeDuration' => $config
      ->get('shadowbox_resize_duration'),
    'showMovieControls' => $config
      ->get('shadowbox_show_movie_controls'),
    'slideshowDelay' => $config
      ->get('shadowbox_slideshow_delay'),
    'viewportPadding' => $config
      ->get('shadowbox_viewport_padding'),
    'useSizzle' => $config
      ->get('shadowbox_use_sizzle'),
    'language' => \Drupal::languageManager()
      ->getCurrentLanguage()->id,
  );
  $settings = array_merge($settings, $override);
  $settings = array(
    'shadowbox' => $settings,
  );
  return $settings;
}