You are here

function osmplayer_player_settings_form in MediaFront 7.2

Same name and namespace in other branches
  1. 6.2 players/osmplayer/osmplayer.module \osmplayer_player_settings_form()
  2. 6 players/osmplayer/osmplayer.module \osmplayer_player_settings_form()
  3. 7 players/osmplayer/osmplayer.module \osmplayer_player_settings_form()

Implements hook_player_settings_form

File

players/osmplayer/osmplayer.module, line 515

Code

function osmplayer_player_settings_form($preset) {

  // Get the information.
  $info = osmplayer_get_info();

  // Get the player templates.
  $templates = array_keys($info['templates']);
  $templates = array_combine($templates, $templates);

  // Get the themes.
  $themes = array_keys($info['themes']);
  $themes = array_combine($themes, $themes);
  $form['presentation'] = array(
    '#type' => 'fieldset',
    '#title' => t('Presentation Settings'),
    '#weight' => -10,
    '#collapsible' => true,
    '#collapsed' => true,
    '#group' => 'player_settings',
  );
  $form['presentation']['theme'] = array(
    '#type' => 'select',
    '#title' => t('Theme'),
    '#description' => t('Select the theme you would like to use for this player.  The theme provides the look and feel for the media player.  Select <strong>&lt;none&gt;</strong> if you would not like to use a theme.<br/>You can download new themes for the OSM Player using the jQuery UI <a target="_blank" href="http://jqueryui.com/themeroller">JQuery UI ThemeRoller</a> interface.  Once you have downloaded a new theme, simply place the contents of that download in the <strong>modules/mediafront/players/osmplayer/player/jquery-ui</strong> folder.  Once you refresh the browser, you should see your new theme show up in this list.<br/><br/><strong>IMPORTANT NOTE:  You cannot have more than one theme present on a page at any given time.  This will cause the themes to override one another causing issues.</strong>'),
    '#options' => array_merge(array(
      'none' => t('<none>'),
    ), $themes),
    '#default_value' => $preset['settings']['theme'],
  );
  $form['presentation']['template'] = array(
    '#type' => 'select',
    '#title' => t('Template'),
    '#description' => t('Select the template you would like to use for this player.  The template provides specific functionality as well as the layout for the media player.  Each template can be found in the <strong>modules/mediafront/players/osmplayer/player/templates</strong> folder.'),
    '#options' => $templates,
    '#default_value' => $preset['settings']['template'],
  );
  $form['presentation']['width'] = array(
    '#type' => 'textfield',
    '#title' => t('Player Width'),
    '#description' => t('Enter the width of the player, or leave blank to provide the width from CSS.  <em>Example: "100%" or "300px".</em>'),
    '#default_value' => $preset['settings']['width'],
  );
  $form['presentation']['height'] = array(
    '#type' => 'textfield',
    '#title' => t('Player Height'),
    '#description' => t('Enter the height of the player, or leave blank to provide the height from CSS. <em>Example: "200px".</em>'),
    '#default_value' => $preset['settings']['height'],
  );
  $form['presentation']['showWhenEmpty'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show player when empty'),
    '#description' => t('Check if you would like to show the player even if there is nothing to play'),
    '#default_value' => $preset['settings']['showWhenEmpty'],
  );
  $form['presentation']['wmode'] = array(
    '#title' => t('Flash Window Mode'),
    '#type' => 'select',
    '#options' => array(
      'none' => 'none',
      'transparent' => 'transparent',
      'window' => 'window',
    ),
    '#default_value' => $preset['settings']['wmode'],
    '#description' => t('Selects which window mode you would like for the OSM Flash player to operate under (denoted by the <b>wmode</b> parameter in the object code)
         <ul>
            <li><b>none</b> - <em>No window mode</em></li>
            <li><b>wmode=transparent</b> - <em>Allows for other elements to drop in front of the video (like a drop-down list), without the video showing over those elements.</em></li>
            <li><b>wmode=window</b> - <em>Allows for the video to have full-screen support.</em></li>
         </ul>'),
  );
  $form['media_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Media Settings'),
    '#weight' => -9,
    '#collapsible' => true,
    '#collapsed' => true,
    '#group' => 'player_settings',
  );
  $form['media_settings']['prereel'] = array(
    '#type' => 'textfield',
    '#title' => t('Pre-Reel'),
    '#description' => t('Enter the path of a media file which you would like to play at the beginning of the main media content.'),
    '#default_value' => $preset['settings']['prereel'],
  );
  $form['media_settings']['postreel'] = array(
    '#type' => 'textfield',
    '#title' => t('Post-Reel'),
    '#description' => t('Enter the path of a media file which you would like to play at the end of the main media content.'),
    '#default_value' => $preset['settings']['postreel'],
  );
  $form['media_settings']['volume'] = array(
    '#type' => 'textfield',
    '#title' => t('Default Volume'),
    '#description' => t('Enter the initial volume for the player.'),
    '#default_value' => $preset['settings']['volume'],
  );
  $form['media_settings']['autoplay'] = array(
    '#type' => 'checkbox',
    '#title' => t('Auto Start'),
    '#description' => t('If checked, the media will automatically load and play once the page loads.'),
    '#default_value' => $preset['settings']['autoplay'],
  );
  $form['media_settings']['autoload'] = array(
    '#type' => 'checkbox',
    '#title' => t('Auto Load'),
    '#description' => t('If checked, the media will automatically start loading once the page loads.'),
    '#default_value' => $preset['settings']['autoload'],
  );

  /*   * *********************** PLAYLIST SETTINGS ************************************ */
  $form['playlist_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Playlist Settings'),
    '#weight' => -8,
    '#collapsible' => true,
    '#collapsed' => true,
    '#group' => 'player_settings',
  );
  $form['playlist_settings']['scrollSettings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Scroll Settings'),
    '#collapsible' => true,
    '#collapsed' => true,
  );
  $form['playlist_settings']['scrollSettings']['scrollMode'] = array(
    '#type' => 'select',
    '#title' => t('Scroll Mode'),
    '#options' => array(
      'auto' => 'Auto Scroll',
      'mouse' => 'Mouse Scroll',
      'hover' => 'Hover Scroll',
      'span' => 'Span Scroll',
      'none' => 'No Scroll',
    ),
    '#description' => t('Specify how you would like the playlist to scroll.
      <ul>
        <li><strong>Auto Scroll</strong> - <em>Make the playlist scroll follow the mouse movements</em></li>
      </ul>'),
    '#default_value' => $preset['settings']['scrollMode'],
  );
  $form['playlist_settings']['scrollSettings']['scrollSpeed'] = array(
    '#type' => 'textfield',
    '#title' => t('Scroll Speed'),
    '#description' => t('The speed which the playlist scrolls.'),
    '#default_value' => $preset['settings']['scrollSpeed'],
  );
  $form['playlist_settings']['displaySettings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Display Settings'),
    '#collapsible' => true,
    '#collapsed' => true,
  );
  $form['playlist_settings']['displaySettings']['disablePlaylist'] = array(
    '#type' => 'checkbox',
    '#title' => t('Disable Playlist'),
    '#description' => t('Will completely remove the playlist, but still provide content within the playlist.'),
    '#default_value' => $preset['settings']['disablePlaylist'],
  );
  $form['playlist_settings']['displaySettings']['showPlaylist'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show Playlist'),
    '#description' => t('Select if you would like to see the playlist by default. ( They can then see the playlist my pressing the maximize button )'),
    '#default_value' => $preset['settings']['showPlaylist'],
  );
  $form['playlist_settings']['displaySettings']['playlistOnly'] = array(
    '#type' => 'checkbox',
    '#title' => t('Playlist Only'),
    '#description' => t('Select if you would like to ONLY see the playlist.'),
    '#default_value' => $preset['settings']['playlistOnly'],
  );
  $form['playlist_settings']['displaySettings']['vertical'] = array(
    '#type' => 'select',
    '#title' => t('Playlist Orientation'),
    '#options' => array(
      false => 'Horizontal',
      true => 'Vertical',
    ),
    '#description' => t('Selecting this will orient the playist either vertical or horizontal.  Note - This will only work if your template supports it.'),
    '#default_value' => $preset['settings']['vertical'],
  );
  $form['playlist_settings']['playlist'] = array(
    '#type' => 'textfield',
    '#title' => t('Default Playlist'),
    '#description' => t('Enter the name or the URL of the playlist you would like to load by default.  This can either be an external XML file, or the name of the view that represents your playlist.  This, however, will be overridden if you explicitly provide the playlist when adding this preset to a page.'),
    '#default_value' => $preset['settings']['playlist'],
  );
  $form['playlist_settings']['pageLimit'] = array(
    '#type' => 'textfield',
    '#title' => t('Page Limit'),
    '#description' => t('Specify how many nodes you would like to show in each page of the playlist.'),
    '#default_value' => $preset['settings']['pageLimit'],
  );
  $form['playlist_settings']['autoNext'] = array(
    '#type' => 'checkbox',
    '#title' => t('Auto Next'),
    '#description' => t('Specify if you would the player to automatically move to the next node after the previous one finishes playing.'),
    '#default_value' => $preset['settings']['autoNext'],
  );
  $form['playlist_settings']['shuffle'] = array(
    '#type' => 'checkbox',
    '#title' => t('Shuffle'),
    '#description' => t('If checked, the playlist will play in a random order.'),
    '#default_value' => $preset['settings']['shuffle'],
  );
  $form['playlist_settings']['loop'] = array(
    '#type' => 'checkbox',
    '#title' => t('Loop'),
    '#description' => t('If checked, the media playlist will play over once it has been completed.  This also applies if there is only a single media being played.'),
    '#default_value' => $preset['settings']['loop'],
  );
  $form['control_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Controller Settings'),
    '#weight' => -6,
    '#collapsible' => true,
    '#collapsed' => true,
    '#group' => 'player_settings',
  );
  $form['control_settings']['showController'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show Controller'),
    '#description' => t('Unchecking this will hide the control bar.'),
    '#default_value' => $preset['settings']['showController'],
  );
  $form['control_settings']['controllerOnly'] = array(
    '#type' => 'checkbox',
    '#title' => t('Controller Only'),
    '#description' => t('Select if you would like to ONLY see the control bar.'),
    '#default_value' => $preset['settings']['controllerOnly'],
  );
  $form['control_settings']['volumeVertical'] = array(
    '#type' => 'checkbox',
    '#title' => t('Volume Vertical'),
    '#description' => t('Unchecking this make the volume horizontal.'),
    '#default_value' => $preset['settings']['volumeVertical'],
  );
  $form['logo_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Logo Settings'),
    '#weight' => -4,
    '#collapsible' => true,
    '#collapsed' => true,
    '#group' => 'player_settings',
  );
  $form['logo_settings']['logo'] = array(
    '#type' => 'textfield',
    '#title' => t('Logo URL'),
    '#description' => t('Enter the relative location of your logo with respect to the Drupal root location.'),
    '#default_value' => $preset['settings']['logo'],
  );
  $form['logo_settings']['link'] = array(
    '#type' => 'textfield',
    '#title' => t('Link URL'),
    '#description' => t('Enter the website that the logo points to.'),
    '#default_value' => $preset['settings']['link'],
  );
  $form['plugins'] = array(
    '#type' => 'fieldset',
    '#title' => t('Plugins'),
    '#weight' => -2,
    '#collapsible' => true,
    '#collapsed' => true,
    '#theme' => 'osmplayer_plugin_table',
    '#group' => 'player_settings',
  );

  // Iterate through all the plugins.
  if (!empty($info['plugins'])) {
    drupal_add_library('system', 'ui.dialog');
    foreach ($info['plugins'] as $name => $plugin) {
      $default = !empty($preset['settings']['plugins'][$name]) ? $preset['settings']['plugins'][$name] : 0;
      $form['plugins'][$name] = array(
        '#type' => 'checkbox',
        '#default_value' => $default,
      );
    }
  }
  else {
    $form['plugins']['no_plugins'] = array(
      '#markup' => 'No plugins found.',
    );
  }
  $form['misc'] = array(
    '#type' => 'fieldset',
    '#title' => t('Other Settings'),
    '#weight' => 0,
    '#collapsible' => true,
    '#collapsed' => true,
    '#group' => 'player_settings',
  );
  $form['misc']['debug'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable Player Debugging'),
    '#description' => t('Select if you would like to see the debug statements from the Media Player.'),
    '#default_value' => $preset['settings']['debug'],
  );
  return $form;
}