You are here

function flowplayer3_admin_settings in SWF Tools 6.2

Menu callback for the FlowPlayer3 settings form.

1 string reference to 'flowplayer3_admin_settings'
flowplayer3_menu in flowplayer3/flowplayer3.module
Implementation of hook_menu().

File

flowplayer3/flowplayer3.admin.inc, line 6

Code

function flowplayer3_admin_settings() {

  // Retrieve combination of default and saved settings
  $saved_settings = _flowplayer3_settings();

  // Retrieve options needed to populate select elements
  $options = _flowplayer3_options();

  // Initialise array to hold form
  $form = array();

  // Add color scheme form
  $form['color'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Color scheme'),
    '#weight' => -1,
    '#attributes' => array(
      'id' => 'flowplayer3_scheme_form',
    ),
    '#theme' => 'flowplayer3_scheme_form',
  );
  $form['color'] += flowplayer3_scheme_form($form_state);

  // Player path
  $form['flowplayer3_files'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Player and plugin files'),
  );
  $form['flowplayer3_files']['flowplayer3_mediaplayer_file'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('flowplayer3_mediaplayer_file', FLOWPLAYER3_MEDIAPLAYER_FILE),
    '#title' => t('Player file'),
    '#description' => t('Specify the name of the player file - with FlowPlayer 3 this typically changes with each new release.'),
    '#size' => 50,
  );
  $form['flowplayer3_files']['flowplayer3_mediaplayer_stream_plugin'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('flowplayer3_mediaplayer_stream_plugin', FLOWPLAYER3_MEDIAPLAYER_STREAM_PLUGIN),
    '#title' => t('RTMP streaming plugin'),
    '#description' => t('Specify the name of the rtmp streaming plugin.'),
    '#size' => 50,
  );
  $form['flowplayer3_files']['flowplayer3_mediaplayer_javascript'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('flowplayer3_mediaplayer_javascript', FLOWPLAYER3_MEDIAPLAYER_JAVASCRIPT),
    '#title' => t('Embedding script'),
    '#description' => t('The path to the FlowPlayer3 embedding script, if FlowPlayer3 embedding is enabled. When downloaded from flowplayer.org the script file is in a subdirectory <em>example</em> so a relative path may be needed when setting this value.'),
    '#size' => 50,
  );
  $form['flowplayer3_files']['flowplayer3_mediaplayer_controls'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('flowplayer3_mediaplayer_controls', ''),
    '#title' => t('Controls'),
    '#description' => t('The path to the FlowPlayer3 controls plug-in. Leave blank to use the default.'),
    '#size' => 50,
  );
  $form['flowplayer3_files']['flowplayer3_product_key'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('flowplayer3_product_key', ''),
    '#title' => t('Product key'),
    '#description' => t('Enter your product key if you are using the commercial version of FlowPlayer 3.'),
    '#size' => 50,
  );

  // Initialise tree from this point forward as want to store arrays
  $form[FLOWPLAYER3_MEDIAPLAYER]['#tree'] = TRUE;

  // Clip settings
  $form[FLOWPLAYER3_MEDIAPLAYER]['clip'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Overall clip properties'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['clip']['autoPlay'] = array(
    '#type' => 'select',
    '#options' => $options['bool'],
    '#default_value' => $saved_settings['clip']['autoPlay'],
    '#title' => t('Auto play'),
    '#description' => t('Flag indicating whether the player should start playback immediately upon loading.'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['clip']['autoBuffering'] = array(
    '#type' => 'select',
    '#options' => $options['bool'],
    '#default_value' => $saved_settings['clip']['autoBuffering'],
    '#title' => t('Auto buffering'),
    '#description' => t('Flag indicating whether loading of clip into player\'s memory should begin straight away. '),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['clip']['scaling'] = array(
    '#type' => 'select',
    '#options' => $options['scaling'],
    '#default_value' => $saved_settings['clip']['scaling'],
    '#title' => t('Scaling'),
    '#description' => t('Specify how the clip should be scaled.'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['clip']['start'] = array(
    '#type' => 'textfield',
    '#default_value' => $saved_settings['clip']['start'],
    '#title' => t('Start'),
    '#description' => t('Specify start point for playback (only works with a streaming server). Streaming support not yet in place for SWF Tools.'),
    '#size' => 8,
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['clip']['duration'] = array(
    '#type' => 'textfield',
    '#default_value' => $saved_settings['clip']['duration'],
    '#title' => t('Duration'),
    '#description' => t('The time (in seconds) for which a video clip should be played until playback ceases.'),
    '#size' => 8,
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['clip']['accelerated'] = array(
    '#type' => 'select',
    '#options' => $options['bool'],
    '#default_value' => $saved_settings['clip']['accelerated'],
    '#title' => t('Acceleration'),
    '#description' => t('Flag indicating whether Flash 9 (and above) hardware-accelerated full screen mode should be used.'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['clip']['bufferLength'] = array(
    '#type' => 'textfield',
    '#default_value' => $saved_settings['clip']['bufferLength'],
    '#title' => t('Buffer length'),
    '#description' => t('The amount of video data (in seconds) which should be loaded into Flowplayer\'s memory in advance of playback commencing. '),
    '#size' => 8,
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['clip']['provider'] = array(
    '#type' => 'textfield',
    '#default_value' => $saved_settings['clip']['provider'],
    '#title' => t('Provider'),
    '#description' => t('Not sure if this will be support in this module. Need to investigate.'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['clip']['fadeInSpeed'] = array(
    '#type' => 'textfield',
    '#default_value' => $saved_settings['clip']['fadeInSpeed'],
    '#title' => t('Fade in speed'),
    '#description' => t('Time in milliseconds to fade from zero to full opacity upon commencement of video playback.'),
    '#size' => 8,
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['clip']['fadeOutSpeed'] = array(
    '#type' => 'textfield',
    '#default_value' => $saved_settings['clip']['fadeOutSpeed'],
    '#title' => t('Fade out speed'),
    '#description' => t('Time in milliseconds to fade from full to zero opacity upon completion of video playback.'),
    '#size' => 8,
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['clip']['linkUrl'] = array(
    '#type' => 'textfield',
    '#default_value' => $saved_settings['clip']['linkUrl'],
    '#title' => t('Link url'),
    '#description' => t('The URL to direct users to when clicking the video screen.'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['clip']['linkWindow'] = array(
    '#type' => 'select',
    '#options' => $options['linkWindow'],
    '#default_value' => $saved_settings['clip']['linkWindow'],
    '#title' => t('Link window'),
    '#description' => t('Setting which defines where URL defined by linkUrl property is opened.'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['clip']['live'] = array(
    '#type' => 'select',
    '#options' => $options['bool'],
    '#default_value' => $saved_settings['clip']['live'],
    '#title' => t('Live'),
    '#description' => t('RTMP streaming servers support live streaming, which means that it is possible to setup a video camera or other live video source to stream live video data to Flowplayer. If you have an RTMP server which is providing a live video stream, you should set this property to true. Streaming support not yet in place for SWF Tools.'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['clip']['cuePointMultiplier'] = array(
    '#type' => 'textfield',
    '#default_value' => $saved_settings['clip']['cuePointMultiplier'],
    '#title' => t('Cue point multiplier'),
    '#description' => t('The times of embedded cuepoints are multiplied by this value before being used. Some encoding tools embed cuepoints in seconds but Flowplayer processes cuepoints in milliseconds. Note that the times are also rounded to the nearest 100 milliseconds. For example, if a file has a cuepoint at 5.535 seconds, the cuepoint is fired at 5500 milliseconds (assuming the default multiplier value of 1000).'),
    '#size' => 8,
  );

  // Control bar settings
  $form[FLOWPLAYER3_MEDIAPLAYER]['controls'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Controlbar properties'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['controls']['backgroundGradient'] = array(
    '#type' => 'select',
    '#options' => $options['gradient'],
    '#default_value' => $saved_settings['controls']['backgroundGradient'],
    '#title' => t('Background gradient'),
    '#description' => t('Gradient setting for the controlbar background.'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['controls']['progressGradient'] = array(
    '#type' => 'select',
    '#options' => $options['gradient'],
    '#default_value' => $saved_settings['controls']['progressGradient'],
    '#title' => t('Progress gradient'),
    '#description' => t('Gradient setting for the progress bar.'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['controls']['bufferGradient'] = array(
    '#type' => 'select',
    '#options' => $options['gradient'],
    '#default_value' => $saved_settings['controls']['bufferGradient'],
    '#title' => t('Buffer gradient'),
    '#description' => t('Gradient setting for the buffer.'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['controls']['sliderGradient'] = array(
    '#type' => 'select',
    '#options' => $options['gradient'],
    '#default_value' => $saved_settings['controls']['sliderGradient'],
    '#title' => t('Slider gradient'),
    '#description' => t('Gradient setting for the sliders.'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['controls']['autoHide'] = array(
    '#type' => 'select',
    '#options' => $options['autoHide'],
    '#default_value' => $saved_settings['controls']['autoHide'],
    '#title' => t('Hide control bar'),
    '#description' => t('Specifies whether the controlbar should be hidden when the user is not actively using the player.'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['controls']['play'] = array(
    '#type' => 'select',
    '#options' => $options['bool'],
    '#default_value' => $saved_settings['controls']['play'],
    '#title' => t('Play button'),
    '#description' => t('Should the play/pause button be visible?'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['controls']['volume'] = array(
    '#type' => 'select',
    '#options' => $options['bool'],
    '#default_value' => $saved_settings['controls']['volume'],
    '#title' => t('Volume button'),
    '#description' => t('Should the volume control be visible?'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['controls']['mute'] = array(
    '#type' => 'select',
    '#options' => $options['bool'],
    '#default_value' => $saved_settings['controls']['mute'],
    '#title' => t('Mute button'),
    '#description' => t('Should the mute button be visible?'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['controls']['time'] = array(
    '#type' => 'select',
    '#options' => $options['bool'],
    '#default_value' => $saved_settings['controls']['time'],
    '#title' => t('Time display'),
    '#description' => t('Should the time display be visible?'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['controls']['stop'] = array(
    '#type' => 'select',
    '#options' => $options['bool'],
    '#default_value' => $saved_settings['controls']['stop'],
    '#title' => t('Stop button'),
    '#description' => t('Should the stop button be visible?'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['controls']['playlist'] = array(
    '#type' => 'select',
    '#options' => $options['bool'],
    '#default_value' => $saved_settings['controls']['playlist'],
    '#title' => t('Playlist buttons'),
    '#description' => t('Should the playlist buttons be visible. These buttons will allow navigation through the playlist entries that have been configured for the player. These buttons are always hidden if there are less than two entries in the playlist.'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['controls']['fullscreen'] = array(
    '#type' => 'select',
    '#options' => $options['bool'],
    '#default_value' => $saved_settings['controls']['fullscreen'],
    '#title' => t('Fullscreen button'),
    '#description' => t('Should the fullscreen button be visible?'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['controls']['scrubber'] = array(
    '#type' => 'select',
    '#options' => $options['bool'],
    '#default_value' => $saved_settings['controls']['scrubber'],
    '#title' => t('Scrubber'),
    '#description' => t('The scrubber is a well known nickname for the timeline/playhead combination. This specifies whether it should be visible.'),
  );

  // Canvas settings
  $form[FLOWPLAYER3_MEDIAPLAYER]['canvas'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Canvas properties'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['canvas']['height'] = array(
    '#type' => 'textfield',
    '#default_value' => $saved_settings['canvas']['height'],
    '#title' => t('Height'),
    '#description' => t('The height of the player in pixels.'),
    '#size' => 8,
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['canvas']['width'] = array(
    '#type' => 'textfield',
    '#default_value' => $saved_settings['canvas']['width'],
    '#title' => t('Width'),
    '#description' => t('The width of the player in pixels.'),
    '#size' => 8,
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['canvas']['backgroundImage'] = array(
    '#type' => 'textfield',
    '#default_value' => $saved_settings['canvas']['backgroundImage'],
    '#title' => t('Background image'),
    '#description' => t('The absolute or relative path to the image that should be used as the background to this plugin. Supported formats are GIF, JPEG and PNG. The syntax is similar to CSS in that you must enclose your path inside a url() wrapper.'),
    '#size' => 24,
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['canvas']['backgroundRepeat'] = array(
    '#type' => 'select',
    '#options' => $options['backgroundRepeat'],
    '#default_value' => $saved_settings['canvas']['backgroundRepeat'],
    '#title' => t('Background repeat'),
    '#description' => t('Default is "repeat", which makes the background image repeat both horizontally and vertically. "no-repeat" displays the background image only once from the top left-hand corner.'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['canvas']['backgroundGradient'] = array(
    '#type' => 'select',
    '#options' => $options['gradient'],
    '#default_value' => $saved_settings['canvas']['backgroundGradient'],
    '#title' => t('Background gradient'),
    '#description' => t('Gradient setting for the canvas.'),
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['canvas']['border'] = array(
    '#type' => 'textfield',
    '#default_value' => $saved_settings['canvas']['border'],
    '#title' => t('Border'),
    '#description' => t('Draws a border around a plugin\'s edges. The syntax follows the CSS standard: width style color. For example: "1px solid #cccccc". The only supported style currently is "solid", but the width and colour can be set to any valid value.'),
    '#size' => 24,
  );
  $form[FLOWPLAYER3_MEDIAPLAYER]['canvas']['borderRadius'] = array(
    '#type' => 'textfield',
    '#default_value' => $saved_settings['canvas']['borderRadius'],
    '#title' => t('Border radius'),
    '#description' => t('Specifies the amount of rounding for each corner. Larger values mean more rounding.'),
    '#size' => 8,
  );

  // Embedding setting
  $form['flowplayer3_embedding'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Flowplayer3 embedding'),
  );
  $form['flowplayer3_embedding']['swftools_flowplayer3_embed'] = array(
    '#type' => 'checkbox',
    '#default_value' => variable_get('swftools_flowplayer3_embed', FALSE),
    '#title' => t('Use FlowPlayer3 embedding'),
    '#description' => t('When checked the default embedding method wil be over-ridden and the FlowPlayer3 embedding script will be used. The script file must be installed and the correct path added in <em>Player and plugin files</em> above.'),
  );
  $form['flowplayer3_embedding']['swftools_flowplayer3_load'] = array(
    '#type' => 'checkbox',
    '#default_value' => variable_get('swftools_flowplayer3_load', TRUE),
    '#title' => t('Load FlowPlayers immediately'),
    '#description' => t('If this option is cleared then the FlowPlayers will not load until the container content is clicked.'),
  );

  // Add custom form handler to flush cache upon submit
  $form['#submit'][] = 'flowplayer3_admin_settings_submit';

  // Return finished form
  return system_settings_form($form);
}