You are here

function video_default_widget_settings in Video 6.5

Same name and namespace in other branches
  1. 6.4 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 362
Common Video module 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 transcoding dimensions'),
    '#default_value' => !empty($widget['default_dimensions']) ? $widget['default_dimensions'] : '',
    '#options' => video_explode("\n", variable_get('video_dimensions', video_default_dimensions())),
    '#description' => t('Default transcoding resolution WIDTHxHEIGHT, in px, that will be uses 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_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'),
    '#default_value' => !empty($widget['autoconversion']) ? $widget['autoconversion'] : 0,
    '#description' => t('Automatically convert videos to web compatible types such as FLV, Please make sure to configure your transcoder settings.') . '<br/><strong>' . t('If this option is not enabled, the input video will be used as it is uploaded.') . '</strong>',
  );

  // 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('Create thumbnails using the selected transcoder. Please make sure to configure your transcoder settings before enabling this option.'),
    '#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;
}