You are here

function video_default_widget_settings in Video 6.4

Same name and namespace in other branches
  1. 6.5 video_widget.inc \video_default_widget_settings()
2 calls to video_default_widget_settings()
uploadfield_widget_settings_form in types/uploadfield/uploadfield_widget.inc
Implementation of CCK's hook_widget_settings($op = 'form').
videoftp_widget_settings_form in types/videoftp/videoftp_widget.inc
Implementation of CCK's hook_widget_settings($op = 'form').

File

./video_widget.inc, line 306
Common widget functions

Code

function video_default_widget_settings($widget) {
  $form = array();

  // Default video settings.
  $form['plugins'] = array(
    '#type' => 'fieldset',
    '#title' => t('Video Advanced Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#weight' => 10,
  );
  $form['plugins']['default_dimensions'] = array(
    '#type' => 'select',
    '#title' => t('Default Video Resolution Dimensions'),
    '#default_value' => !empty($widget['default_dimensions']) ? $widget['default_dimensions'] : '',
    '#options' => video_explode("\n", variable_get("video_metadata_dimensions", video_default_dimensions())),
    '#description' => t('Default transcoding resolution WIDTHxHEIGHT, in px, that FFMPEG will use to transcode your video files.'),
  );
  $form['plugins']['default_player_dimensions'] = array(
    '#type' => 'select',
    '#title' => t('Default Video Player Dimensions'),
    '#default_value' => !empty($widget['default_player_dimensions']) ? $widget['default_player_dimensions'] : '',
    '#options' => video_explode("\n", variable_get("video_metadata_dimensions", video_default_dimensions())),
    '#description' => t('Default player WIDTHxHEIGHT in px.  This is your actual player dimensions that your video will be playing in.'),
  );
  $form['plugins']['autoconversion'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable video conversion.'),
    '#description' => t('Use ffmpeg(Default) to automatically convert videos to web compatible types eg. FLV, Please make sure to configure your transcoder settings.'),
    '#default_value' => $widget['autoconversion'],
  );

  // Default thumbnail settings.
  $form['default'] = array(
    '#type' => 'fieldset',
    '#title' => t('Video Thumbnail Settings'),
    '#element_validate' => array(
      'video_default_widget_settings_validate',
    ),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#weight' => 11,
  );
  $thumb_options = array(
    'auto' => 'Automatically generate thumbnails',
    'auto_fallback' => 'Automatically generate thumbnails, with fallback to manual upload',
    'manual_upload' => 'Manually upload a thumbnail',
    'no' => 'Don\'t create thumbnail',
  );
  $form['default']['autothumbnail'] = array(
    '#type' => 'radios',
    '#title' => t('Thumbnail Generation'),
    '#options' => $thumb_options,
    '#description' => t('To use ffmpeg(Default) to create thumbnails, Please make sure to configure your transcoder settings before using ffmpeg to create thumbnails.'),
    '#default_value' => isset($widget['autothumbnail']) ? $widget['autothumbnail'] : 'no',
  );

  // @TODO: Move this to the actual upload/attach when creating a node to allow the user to upload their own thumbnail for each video.
  // Present a video image of the current default image.
  if (!empty($widget['default_video_thumb'])) {
    $form['default']['default_video_thumbnail'] = array(
      '#type' => 'markup',
      '#value' => theme('video_image', $widget['default_video_thumb'], '', '', array(
        'width' => '150',
      ), FALSE),
      '#prefix' => '<div class="video_thumbnail">',
      '#suffix' => '</div>',
    );
    $form['default']['delete_default_video_thumbnail'] = array(
      '#type' => 'checkbox',
      '#title' => t('Delete the default thumbnail'),
    );
  }
  $form['default']['default_video_thumb_upload'] = array(
    '#type' => 'file',
    '#title' => empty($widget['default_video_thumb']) ? t('Upload default video thumbnail') : t('Replace default video thumbnail with'),
    '#description' => t('Choose a image that will be used as video thumbnail when you don\'t have video thumbnails for videos.'),
  );

  // We set this value on 'validate' so we can get CCK to add it
  // as a standard field setting.
  $form['default_video_thumb'] = array(
    '#type' => 'value',
    '#value' => isset($widget['default_video_thumb']) ? $widget['default_video_thumb'] : NULL,
  );
  return $form;
}