You are here

function shadowbox_admin_settings in Shadowbox 6

Same name and namespace in other branches
  1. 5 shadowbox.module \shadowbox_admin_settings()

FAPI definition for the Shadowbox admin settings form.

See also

shadowbox_admin_settings_validate()

1 string reference to 'shadowbox_admin_settings'
shadowbox_menu in ./shadowbox.module
Implementation of hook_menu().

File

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

Code

function shadowbox_admin_settings() {

  // Global settings
  $form['shadowbox'] = array(
    '#type' => 'fieldset',
    '#title' => t('Global settings'),
    '#access' => user_access('administer shadowbox'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['shadowbox']['shadowbox_enabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable Shadowbox'),
    '#default_value' => variable_get('shadowbox_enabled', TRUE),
    '#description' => t('Check this box to enable Shadowbox for the site.'),
  );
  $form['shadowbox']['shadowbox_css_skin'] = array(
    '#type' => 'select',
    '#title' => t('Skin'),
    '#multiple' => FALSE,
    '#description' => t('Select the skin to use for the Shadowbox overlay.'),
    '#options' => array(
      'original' => 'Original',
      'light' => 'Light',
    ),
    '#default_value' => variable_get('shadowbox_css_skin', 'original'),
  );
  $form['shadowbox']['shadowbox_excluded_pages'] = array(
    '#type' => 'textarea',
    '#title' => t('Deactivate Shadowbox on specific pages'),
    '#default_value' => variable_get('shadowbox_excluded_pages', "admin*\nimg_assist*\nnode/add/*\nnode/*/edit"),
    '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array(
      '%blog' => 'blog',
      '%blog-wildcard' => 'blog/*',
      '%front' => '<front>',
    )),
  );

  // Supported media
  $form['shadowbox']['shadowbox_supported_media'] = array(
    '#type' => 'fieldset',
    '#title' => t('Supported media'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['shadowbox']['shadowbox_supported_media']['shadowbox_supported_images'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Image'),
    '#description' => t('Supported image file extensions'),
    '#options' => drupal_map_assoc(shadowbox_get_types('image')),
    '#default_value' => variable_get('shadowbox_supported_images', shadowbox_get_types('image')),
  );
  $form['shadowbox']['shadowbox_supported_media']['shadowbox_supported_quicktime'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Quicktime'),
    '#description' => t('Movie file extensions supported by QuickTime'),
    '#options' => drupal_map_assoc(shadowbox_get_types('quicktime')),
    '#default_value' => variable_get('shadowbox_supported_quicktime', shadowbox_get_types('quicktime')),
  );
  $form['shadowbox']['shadowbox_supported_media']['shadowbox_supported_wmp'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Windows Media Player'),
    '#description' => t('Movie file extensions supported by Windows Media Player'),
    '#options' => drupal_map_assoc(shadowbox_get_types('wmp')),
    '#default_value' => variable_get('shadowbox_supported_wmp', shadowbox_get_types('wmp')),
  );
  $form['shadowbox']['shadowbox_supported_media']['shadowbox_supported_qtwmp'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Quicktime and Windows Media Player'),
    '#description' => t('Movie file extensions supported by both QuickTime and Windows Media Player'),
    '#options' => drupal_map_assoc(shadowbox_get_types('qtwmp')),
    '#default_value' => variable_get('shadowbox_supported_qtwmp', shadowbox_get_types('qtwmp')),
  );
  $form['shadowbox']['shadowbox_supported_media']['shadowbox_supported_iframe'] = array(
    '#type' => 'checkboxes',
    '#title' => t('IFrame'),
    '#description' => t('File extensions that will be display in an iframe'),
    '#options' => drupal_map_assoc(shadowbox_get_types('iframe')),
    '#default_value' => variable_get('shadowbox_supported_iframe', shadowbox_get_types('iframe')),
  );

  // Options
  $form['shadowbox']['shadowbox_options'] = array(
    '#type' => 'fieldset',
    '#title' => t('Options'),
    '#description' => t('Shadowbox is highly configurable, but can also be used with little to no configuration at all. The following options may be used to configure Shadowbox on a site-wide basis.'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#access' => user_access('administer shadowbox'),
  );

  // Assets
  $form['shadowbox']['shadowbox_options']['asset_paths'] = array(
    '#type' => 'fieldset',
    '#title' => t('Assets'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['shadowbox']['shadowbox_options']['asset_paths']['shadowbox_asset_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Base asset URL'),
    '#description' => t('The path to the assets (loading image, FLV player, and background image). Relative to Drupal root e.g. <code>sites/all/modules/shadowbox/shadowbox</code>.'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => variable_get('shadowbox_asset_url', drupal_get_path('module', 'shadowbox') . '/shadowbox'),
  );
  $form['shadowbox']['shadowbox_options']['asset_paths']['shadowbox_loading_image'] = array(
    '#type' => 'textfield',
    '#title' => t('Loading image path'),
    '#description' => t('The URL of an image to use as a loading indicator while loading content.'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => variable_get('shadowbox_loading_image', 'images/loading.gif'),
  );
  $form['shadowbox']['shadowbox_options']['asset_paths']['shadowbox_flv_player'] = array(
    '#type' => 'textfield',
    '#title' => t('FLV player'),
    '#description' => t('The URL of the flash video player.'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => variable_get('shadowbox_flv_player', 'flvplayer.swf'),
  );

  // Animation
  $form['shadowbox']['shadowbox_options']['animation_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Animation'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['shadowbox']['shadowbox_options']['animation_settings']['shadowbox_animate'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable animation'),
    '#description' => t('Enable all fancy dimension and opacity animations. Disabling this option can improve the overall effect on computers with poor performance.'),
    '#default_value' => variable_get('shadowbox_animate', TRUE),
  );
  $form['shadowbox']['shadowbox_options']['animation_settings']['shadowbox_animation_sequence'] = array(
    '#type' => 'select',
    '#title' => t('Animation sequence'),
    '#multiple' => FALSE,
    '#description' => t('The animation sequence to use when resizing Shadowbox.'),
    '#options' => array(
      'wh' => t('Width then height'),
      'hw' => t('Height then width'),
      'sync' => t('Simultaneously'),
    ),
    '#default_value' => variable_get('shadowbox_animation_sequence', 'wh'),
  );
  $form['shadowbox']['shadowbox_options']['animation_settings']['shadowbox_resize_duration'] = array(
    '#type' => 'textfield',
    '#title' => t('Resize duration'),
    '#description' => t('The duration (in seconds) of the resizing animations.'),
    '#size' => 5,
    '#maxlength' => 4,
    '#default_value' => variable_get('shadowbox_resize_duration', 0.35),
  );
  $form['shadowbox']['shadowbox_options']['animation_settings']['shadowbox_fade_duration'] = array(
    '#type' => 'textfield',
    '#title' => t('Fade duration'),
    '#description' => t('The duration (in seconds) of the overlay fade animation.'),
    '#size' => 5,
    '#maxlength' => 4,
    '#default_value' => variable_get('shadowbox_fade_duration', 0.35),
  );
  $form['shadowbox']['shadowbox_options']['animation_settings']['shadowbox_initial_height'] = array(
    '#type' => 'textfield',
    '#title' => t('Initial height'),
    '#description' => t('The height of Shadowbox (in pixels) when it first appears on the screen.'),
    '#size' => 5,
    '#maxlength' => 4,
    '#default_value' => variable_get('shadowbox_initial_height', 160),
  );
  $form['shadowbox']['shadowbox_options']['animation_settings']['shadowbox_initial_width'] = array(
    '#type' => 'textfield',
    '#title' => t('Initial width'),
    '#description' => t('The width of Shadowbox (in pixels) when it first appears on the screen. '),
    '#size' => 5,
    '#maxlength' => 4,
    '#default_value' => variable_get('shadowbox_initial_width', 320),
  );

  // Overlay
  $form['shadowbox']['shadowbox_options']['overlay'] = array(
    '#type' => 'fieldset',
    '#title' => t('Overlay'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['shadowbox']['shadowbox_options']['overlay']['shadowbox_overlay_color'] = array(
    '#type' => 'textfield',
    '#title' => t('Overlay color'),
    '#description' => t('Select a hexadecimal color value for the overlay (e.g. #000 or #000000 for black).'),
    '#size' => 8,
    '#maxlength' => 7,
    '#default_value' => variable_get('shadowbox_overlay_color', '#000'),
  );
  $form['shadowbox']['shadowbox_options']['overlay']['shadowbox_overlay_opacity'] = array(
    '#type' => 'textfield',
    '#title' => t('Overlay opacity'),
    '#description' => t('The opacity of the overlay. Accepts values between 0 and 1. 0 is fully transparent, 1 is fully opaque.'),
    '#size' => 5,
    '#maxlength' => 4,
    '#default_value' => variable_get('shadowbox_overlay_opacity', 0.85),
  );
  $form['shadowbox']['shadowbox_options']['overlay']['shadowbox_background_image'] = array(
    '#type' => 'textfield',
    '#title' => t('Overlay backround image'),
    '#description' => t('The URL of a pre-made image to use for browsers (such as FF Mac) that don\'t support playing movies over backgrounds that are not 100% opaque.'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => variable_get('shadowbox_background_image', 'images/overlay-85.png'),
  );
  $form['shadowbox']['shadowbox_options']['overlay']['shadowbox_viewport_padding'] = array(
    '#type' => 'textfield',
    '#title' => t('Viewport padding'),
    '#description' => t('The amount of padding (in pixels) to maintain around the edge of the browser window.'),
    '#size' => 4,
    '#maxlength' => 4,
    '#default_value' => variable_get('shadowbox_viewport_padding', 20),
  );

  // Galleries
  $form['shadowbox']['shadowbox_options']['gallery'] = array(
    '#type' => 'fieldset',
    '#title' => t('Galleries'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['shadowbox']['shadowbox_options']['gallery']['shadowbox_display_nav'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display gallery navigation.'),
    '#description' => t('Uncheck this option to hide the gallery navigation controls.'),
    '#default_value' => variable_get('shadowbox_display_nav', TRUE),
  );
  $form['shadowbox']['shadowbox_options']['gallery']['shadowbox_continuous_galleries'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable continuous galleries'),
    '#description' => t('Check this option to enable "continuous" galleries. By default, the galleries will not let a user go before the first image or after the last. Enabling this feature will let the user go directly to the first image in a gallery from the last one by selecting "Next".'),
    '#default_value' => variable_get('shadowbox_continuous_galleries', FALSE),
  );
  $form['shadowbox']['shadowbox_options']['gallery']['shadowbox_display_counter'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable counter'),
    '#description' => t('Uncheck this option to hide the gallery counter. Counters are never displayed on elements that are not part of a gallery.'),
    '#default_value' => variable_get('shadowbox_display_counter', TRUE),
  );
  $form['shadowbox']['shadowbox_options']['gallery']['shadowbox_counter_type'] = array(
    '#type' => 'select',
    '#title' => t('Counter type'),
    '#multiple' => FALSE,
    '#description' => t('The mode to use for the gallery counter. May be either \'default\' or \'skip\'. The default counter is a simple \'1 of 5\' message. The skip counter displays a separate link to each piece in the gallery, enabling quick navigation in large galleries.'),
    '#options' => array(
      'default' => t('Default'),
      'skip' => t('Skip'),
    ),
    '#default_value' => variable_get('shadowbox_counter_type', 'default'),
  );

  // Movies
  $form['shadowbox']['shadowbox_options']['movies'] = array(
    '#type' => 'fieldset',
    '#title' => t('Movies'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['shadowbox']['shadowbox_options']['movies']['shadowbox_autoplay_movies'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable auto-play movies'),
    '#description' => t('Set this false to disable automatically playing movies when they are loaded.'),
    '#default_value' => variable_get('shadowbox_autoplay_movies', TRUE),
  );
  $form['shadowbox']['shadowbox_options']['movies']['shadowbox_show_movie_controls'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable movie controls'),
    '#description' => t('Set this false to disable displaying QuickTime and Windows Media player movie control bars.'),
    '#default_value' => variable_get('shadowbox_show_movie_controls', TRUE),
  );

  // Input controls
  $form['shadowbox']['shadowbox_options']['input'] = array(
    '#type' => 'fieldset',
    '#title' => t('Input controls'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['shadowbox']['shadowbox_options']['input']['shadowbox_overlay_listen'] = array(
    '#type' => 'checkbox',
    '#title' => t('Mouse click closes overlay.'),
    '#description' => t('Set this false to disable listening for mouse clicks on the overlay that will close Shadowbox.'),
    '#default_value' => variable_get('shadowbox_overlay_listen', TRUE),
  );
  $form['shadowbox']['shadowbox_options']['input']['keyboard'] = array(
    '#type' => 'fieldset',
    '#title' => t('Keyboard controls'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['shadowbox']['shadowbox_options']['input']['keyboard']['shadowbox_enable_keys'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable keys'),
    '#description' => t('Set this false to disable keyboard navigation of galleries.'),
    '#default_value' => variable_get('shadowbox_enable_keys', TRUE),
  );
  $form['shadowbox']['shadowbox_options']['input']['keyboard']['shadowbox_keys_close'] = array(
    '#type' => 'textfield',
    '#title' => t('Close keys'),
    '#description' => t('A list of keys (or key codes) that a user may use to close Shadowbox. Values should be separated by a space. Defaults to \'c q 27\' (c, q, or esc).'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => variable_get('shadowbox_keys_close', 'c q 27'),
  );
  $form['shadowbox']['shadowbox_options']['input']['keyboard']['shadowbox_keys_previous'] = array(
    '#type' => 'textfield',
    '#title' => t('Previous keys'),
    '#description' => t('An list of keys (or key codes) that a user may use to skip to the previous piece in the gallery. Values should be separated by a space. Defaults to \'p, 37\' (p or left arrow).'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => variable_get('shadowbox_keys_previous', 'p 37'),
  );
  $form['shadowbox']['shadowbox_options']['input']['keyboard']['shadowbox_keys_next'] = array(
    '#type' => 'textfield',
    '#title' => t('Next keys'),
    '#description' => t('A list of keys (or key codes) that a user may use to skip to the next piece in the gallery. Values should be separated by a space. Defaults to \'n, 39\' (n or right arrow).'),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => variable_get('shadowbox_keys_next', 'n 39'),
  );

  // Media handling
  $form['shadowbox']['shadowbox_options']['media_handling'] = array(
    '#type' => 'fieldset',
    '#title' => t('Media handling'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['shadowbox']['shadowbox_options']['media_handling']['shadowbox_handle_large_images'] = array(
    '#type' => 'select',
    '#title' => t('Handle large images'),
    '#multiple' => FALSE,
    '#description' => t('The mode to use for handling images that are too large for the viewport. May be one of "none", "resize", or "drag". The "none" setting will not alter the image dimensions, though clipping will occur. Setting this to "resize" enables on-the-fly resizing of large images. In this mode, the height and width of large images will be adjusted so that they may still be viewed in their entirety while maintaining the original aspect ratio. The "drag" mode will display the image at its original resolution, but will allow the user to drag the image within the view to see portions that may be clipped.'),
    '#options' => array(
      'resize' => t('Resize'),
      'drag' => t('Drag'),
      'none' => t('None'),
    ),
    '#default_value' => variable_get('shadowbox_handle_large_images', 'resize'),
  );
  $form['shadowbox']['shadowbox_options']['media_handling']['shadowbox_handle_unsupported'] = array(
    '#type' => 'select',
    '#title' => t('Handle unsupported'),
    '#multiple' => FALSE,
    '#description' => t('The mode to use for handling unsupported media. May be either <strong>link</strong> or <strong>remove</strong>. Media are unsupported when the browser plugin required to display the media properly is not installed. The link option will display a user-friendly error message with a link to a page where the needed plugin can be downloaded. The remove option will simply remove any unsupported gallery elements from the gallery before displaying it. With this option, if the element is not part of a gallery, the link will simply be followed.'),
    '#options' => array(
      'link' => t('Link'),
      'remove' => t('Remove'),
    ),
    '#default_value' => variable_get('shadowbox_handle_unsupported', 'link'),
  );
  return system_settings_form($form);
}