You are here

function video_embed_field_handler_youtube_form in Video Embed Field 7.2

Same name and namespace in other branches
  1. 7 video_embed_field.module \video_embed_field_handler_youtube_form()

Defines the form elements for the Youtube configuration form.

Parameters

array $defaults: The form default values.

Return value

array The provider settings form array.

1 string reference to 'video_embed_field_handler_youtube_form'
video_embed_field_video_embed_handler_info in ./video_embed_field.handlers.inc
Implements hook_video_embed_handler_info().

File

./video_embed_field.handlers.inc, line 327
Provide some handlers for video embed field Other modules can implement the hook_video_embed_handler_info to provide more handlers.

Code

function video_embed_field_handler_youtube_form($defaults) {
  $form = array();
  $form['width'] = array(
    '#type' => 'textfield',
    '#size' => '5',
    '#title' => t('Player Width'),
    '#description' => t('The width of the youtube player.'),
    '#default_value' => $defaults['width'],
  );
  $form['height'] = array(
    '#type' => 'textfield',
    '#size' => '5',
    '#title' => t('Player Height'),
    '#description' => t('The height of the youtube player.'),
    '#default_value' => $defaults['height'],
  );
  $form['theme'] = array(
    '#type' => 'select',
    '#options' => array(
      'dark' => t('Dark'),
      'light' => t('Light'),
    ),
    '#title' => t('Player theme'),
    '#default_value' => $defaults['theme'],
  );
  $form['autoplay'] = array(
    '#type' => 'checkbox',
    '#title' => t('Autoplay'),
    '#description' => t('Play the video immediately.'),
    '#default_value' => $defaults['autoplay'],
  );
  $form['vq'] = array(
    '#type' => 'select',
    '#title' => t('Video quality'),
    '#options' => array(
      'small' => t('Small (240p)'),
      'medium' => t('Medium (360p)'),
      'large' => t('Large (480p)'),
      'hd720' => t('HD 720p'),
      'hd1080' => t('HD 10800p'),
    ),
    '#default_value' => $defaults['vq'],
    '#description' => t('Attempt to play the video in certain quality if available.'),
  );
  $form['rel'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show related videos'),
    '#description' => t('Show related videos after the video is finished playing.'),
    '#default_value' => $defaults['rel'],
  );
  $form['showinfo'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show info'),
    '#description' => t('Display information like the video title and rating before the video starts playing.'),
    '#default_value' => $defaults['showinfo'],
  );
  $form['modestbranding'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hide Youtube logo'),
    '#description' => t('Hide the Youtube logo button on the player'),
    '#default_value' => $defaults['modestbranding'],
  );
  $form['iv_load_policy'] = array(
    '#type' => 'radios',
    '#options' => array(
      1 => t('Show video annotations.'),
      3 => t('Hide video annotations.'),
    ),
    '#title' => t('Display annotations'),
    '#description' => t('Controls the display of annotations over the video content. Only works when using the flash player.'),
    '#default_value' => $defaults['iv_load_policy'],
  );
  $form['controls'] = array(
    '#type' => 'radios',
    '#options' => array(
      0 => t('Hide video controls.'),
      1 => t('Show video controls. Youtube default.'),
      2 => t('Show video controls with performance improvement for iframe embeds.'),
    ),
    '#title' => t('Display Youtube player controls'),
    '#description' => t('This parameter indicates whether the video player controls will display.'),
    '#default_value' => $defaults['controls'],
  );
  $form['autohide'] = array(
    '#type' => 'radios',
    '#options' => array(
      0 => t('The video progress bar and player controls will be visible throughout the video.'),
      1 => t('Automatically slide the video progress bar and the player controls out of view a couple of seconds after the video starts playing. They will only reappear if the user moves her mouse over the video player or presses a keyboard key.'),
      2 => t('The video progress bar will fade out but the player controls (play button, volume control, etc.) remain visible.'),
    ),
    '#title' => t('Autohide progress bar and the player controls'),
    '#description' => t('Controls the autohide behavior of the youtube player controls.'),
    '#default_value' => $defaults['autohide'],
  );
  $form['class'] = array(
    '#type' => 'textfield',
    '#title' => t('Player CSS class'),
    '#description' => t('CSS class to add to the player'),
    '#default_value' => $defaults['class'],
  );
  return $form;
}