You are here

function video_players_admin_settings in Video 7

Same name and namespace in other branches
  1. 6.5 video.admin.inc \video_players_admin_settings()
  2. 6.4 video.admin.inc \video_players_admin_settings()
  3. 7.2 modules/video_ui/video.admin.inc \video_players_admin_settings()

Video player admin settings

Return value

<type>

1 string reference to 'video_players_admin_settings'
video_ui_menu in modules/video_ui/video_ui.module
Implementation of hook_menu().

File

modules/video_ui/video.admin.inc, line 93
Provides the administration settings for the Video Drupal module.

Code

function video_players_admin_settings() {
  $form = array();
  $form['extensions'] = array(
    '#type' => 'fieldset',
    '#title' => t('Video Extensions'),
    '#description' => t('Here you can map specific players to each video extension type.'),
  );

  //lets get all our supported extensions and players.
  $extensions = video_video_extensions();
  $players = video_video_players();
  $flv_players = video_video_flv_players();
  $html5_players = video_video_html5_players();
  foreach ($extensions as $ext => $player) {
    $form['extensions']['video_extension_' . $ext] = array(
      '#type' => 'select',
      '#title' => t('Extension:') . '  ' . $ext,
      '#default_value' => variable_get('video_extension_' . $ext, $player),
      '#options' => $players,
      '#prefix' => '<div class="video_select" rel="' . $ext . '">',
      '#suffix' => '</div>',
    );

    // For flash
    if (!empty($flv_players)) {
      $form['extensions']['video_extension_' . $ext . '_flash_player'] = array(
        '#type' => 'radios',
        '#title' => t('Flash Player for') . ' ' . $ext,
        '#options' => $flv_players,
        '#default_value' => variable_get('video_extension_' . $ext . '_flash_player', ''),
        '#prefix' => '<div class="admin_flv_player_wrapper" id="flv_player_' . $ext . '">',
        '#suffix' => '</div>',
      );
    }
    else {
      $form['extensions']['video_extension_' . $ext . '_flash_player'] = array(
        '#type' => 'markup',
        '#markup' => t('No flash players detected.<br />You need to install !swf_tools or !flowplayer.', array(
          '!swf_tools' => l(t('SWF Tools'), 'http://www.drupal.org/project/swftools'),
          '!flowplayer' => l(t('Flowplayer'), 'http://www.drupal.org/project/flowplayer'),
        )),
        '#prefix' => '<div class="admin_flv_player_wrapper" id="flv_player_' . $ext . '">',
        '#suffix' => '</div>',
      );
    }

    // for HTML5
    if (!empty($html5_players)) {
      $form['extensions']['video_extension_' . $ext . '_html5_player'] = array(
        '#type' => 'radios',
        '#title' => t('HTML5 Player for') . ' ' . $ext,
        '#options' => $html5_players,
        '#markup' => t('Additional HTML5 players module.<br />You can install !VideoJS.', array(
          '!VideoJS' => l(t('Video JS'), 'http://www.drupal.org/project/videojs'),
        )),
        '#default_value' => variable_get('video_extension_' . $ext . '_html5_player', ''),
        '#prefix' => '<div class="admin_html5_player_wrapper" id="html5_player_' . $ext . '">',
        '#suffix' => '</div>',
      );
    }
  }
  return system_settings_form($form);
}