You are here

function videoftp_widget_settings_form in Video 6.5

Same name and namespace in other branches
  1. 6.4 types/videoftp/videoftp_widget.inc \videoftp_widget_settings_form()

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

1 call to videoftp_widget_settings_form()
videoftp_widget_settings in types/videoftp/videoftp.module
Implementation of CCK's hook_widget_settings().

File

types/videoftp/videoftp_widget.inc, line 12
videoftp widget hooks and callbacks.

Code

function videoftp_widget_settings_form($widget) {

  // Prevent some notices
  if (!isset($widget['max_filesize_per_file'])) {
    $widget['max_filesize_per_file'] = '';
  }
  if (!isset($widget['max_filesize_per_node'])) {
    $widget['max_filesize_per_node'] = '';
  }
  $form = module_invoke('filefield', 'widget_settings', 'form', $widget);
  unset($form['progress_indicator']);
  if ($form['file_extensions']['#default_value'] == 'txt') {
    $form['file_extensions']['#default_value'] = 'mp4 mpeg avi mpg wmv flv mov';
  }

  // Fix our path settings
  $form['path_settings']['file_path']['#default_value'] = ltrim(ltrim($form['path_settings']['file_path']['#default_value'], 'videos'), '/');
  $form['path_settings']['file_path']['#description'] = t('Optional subdirectory within the "<em>files/videos/</em>" directory where files will be stored. Do not include preceding or trailing slashes.');
  array_unshift($form['path_settings']['file_path']['#element_validate'], 'video_widget_settings_file_path_validate');
  $form['path_settings']['ftp_path'] = array(
    '#type' => 'textfield',
    '#title' => t('FTP path'),
    '#default_value' => !empty($widget['ftp_path']) ? $widget['ftp_path'] : 'ftpvideos',
    '#description' => t('The subdirectory within the "<em>files/</em>" directory where you have upload the videos for attachment.  Once the video is attached it will be moved from this directory to the main files directory.'),
    '#required' => TRUE,
    '#weight' => 3,
  );

  // Default settings
  $default = video_default_widget_settings($widget);
  $form = $form + $default;
  return $form;
}