You are here

function uploadfield_widget_settings_form in Video 6.3

Same name and namespace in other branches
  1. 6.5 types/uploadfield/uploadfield_widget.inc \uploadfield_widget_settings_form()
  2. 6.4 types/uploadfield/uploadfield_widget.inc \uploadfield_widget_settings_form()

Implementation of CCK's hook_widget_settings($op = 'form').

1 call to uploadfield_widget_settings_form()
uploadfield_widget_settings in types/uploadfield/uploadfield.module
Implementation of CCK's hook_widget_settings().

File

types/uploadfield/uploadfield_widget.inc, line 11
uploadfield widget hooks and callbacks.

Code

function uploadfield_widget_settings_form($widget) {
  $form = module_invoke('filefield', 'widget_settings', 'form', $widget);
  if ($form['file_extensions']['#default_value'] == 'txt') {
    $form['file_extensions']['#default_value'] = 'mp4 mpeg avi mpg wmv flv';
  }

  // Default video player settings.
  $form['player'] = array(
    '#type' => 'fieldset',
    '#title' => t('Video Player Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#weight' => 9,
  );
  $form['player']['default_resolution'] = array(
    '#type' => 'textfield',
    '#title' => t('Default Video Resolution'),
    '#default_value' => !empty($widget['default_resolution']) ? $widget['default_resolution'] : '16:9',
    '#size' => 15,
    '#maxlength' => 5,
    '#description' => t('Default player resolution WIDTH:HEIGHT in px. eg : 16:9 for widescreen or 4:3 for general screen'),
  );
  $form['player']['default_width'] = array(
    '#type' => 'textfield',
    '#title' => t('Default Video Player Width'),
    '#default_value' => !empty($widget['default_width']) ? $widget['default_width'] : 640,
    '#size' => 15,
    '#maxlength' => 5,
    '#description' => t('Default player WIDTH:HEIGHT in px. eg : 640 for 640X480 player size if resolution it 4:3'),
  );

  // Default image settings.
  $form['default'] = array(
    '#type' => 'fieldset',
    '#title' => t('Video Thumbnail Settings'),
    '#element_validate' => array(
      '_uploadfield_widget_settings_default_validate',
    ),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#weight' => 10,
  );

  // 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('uploadfield_image', $widget['default_video_thumb'], '', '', array(
        'width' => '150',
      ), FALSE),
      '#prefix' => '<div class="video_thumbnail">',
      '#suffix' => '</div>',
    );
  }
  $form['default']['default_video_thumb_upload'] = array(
    '#type' => 'file',
    '#title' => empty($widget['default_video_thumb']) ? t('Upload video thumbnail') : t('Replace video thumbnail with'),
    '#description' => t('Choose a image that will be used as default video thumbnail.'),
  );

  // 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' => $widget['default_video_thumb'],
  );

  // Default image settings.
  $form['plugings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Video Advanced Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#weight' => 10,
  );
  $form['plugings']['autoconversion'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable auto conversion video'),
    '#description' => t('Use ffmpeg(Default) to automatically convert videos to web compatible types eg. FLV, Please make sure to configure convertor settings.'),
    '#default_value' => $widget['autoconversion'],
  );
  $form['plugings']['autothumbnail'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable auto thumbnail video'),
    '#description' => t('Use ffmpeg(Default) to automatically thumbnails, Please make sure to configure convertor settings.'),
    '#default_value' => $widget['autothumbnail'],
  );
  return $form;
}