From eaa5a4f6e2c2feac03442184198315eb795ac282 Mon Sep 17 00:00:00 2001 From: Heshan Wanigasooriya Date: Sun, 12 Dec 2010 16:13:48 +0000 Subject: Updating the video field to the save their settings. --- video.field.inc | 57 ++++++++++++++++++++++++--------------------------------- 1 file changed, 24 insertions(+), 33 deletions(-) (limited to 'video.field.inc') diff --git a/video.field.inc b/video.field.inc index 2bb4ecc..2b475e4 100644 --- a/video.field.inc +++ b/video.field.inc @@ -20,7 +20,7 @@ function video_field_info() { 'default_video_thumbnail' => 0, ), 'instance_settings' => array( - 'file_extensions' => 'avi wmv flv', + 'file_extensions' => 'mp4 ogg avi mov wmv flv', 'file_directory' => '', 'max_filesize' => '', 'max_resolution' => '', @@ -51,14 +51,6 @@ function video_field_settings_form($field, $instance) { '#description' => t('Select where the final files should be stored. Private file storage has significantly more overhead than public files, but allows restricted access to files within this field.'), ); - $form['default_video_thumbnail'] = array( - '#title' => t('Default video thumbnail'), - '#type' => 'managed_file', - '#description' => t('If use default thumbnanil is selected, this image will be shown on display.'), - '#default_value' => $field['settings']['default_video_thumbnail'], - '#upload_location' => 'public://default_video_thumbnail/', - ); - return $form; } @@ -75,28 +67,6 @@ function video_field_instance_settings_form($field, $instance) { return $form; } -/** - * Element validate function for resolution fields. - */ -function _video_field_resolution_validate($element, &$form_state) { - if (!empty($element['x']['#value']) || !empty($element['y']['#value'])) { - foreach (array('x', 'y') as $dimension) { - $value = $element[$dimension]['#value']; - if (!is_numeric($value)) { - form_error($element[$dimension], t('Height and width values must be numeric.')); - return; - } - if (intval($value) == 0) { - form_error($element[$dimension], t('Both a height and width value must be specified in the !name field.', array('!name' => $element['#title']))); - return; - } - } - form_set_value($element, intval($element['x']['#value']) . 'x' . intval($element['y']['#value']), $form_state); - } else { - form_set_value($element, '', $form_state); - } -} - /** * Implements hook_field_load(). */ @@ -204,10 +174,31 @@ function video_field_widget_settings_form($field, $instance) { $settings = $widget['settings']; // Use the file widget settings form. $form = file_field_widget_settings_form($field, $instance); - + switch ($instance['widget']['type']) { + case 'video_upload': + break; + case 'video_ftp': + $form['ftp_path'] = array( + '#type' => 'textfield', + '#title' => t('FTP Filepath'), + '#default_value' => !empty($widget['ftp_path']) ? $widget['ftp_path'] : 'ftpvideos', + '#description' => t('The subdirectory within the "files/" 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, + ); + break; + } //default settings $default = video_default_widget_settings($settings); - $form = $default + $form; + $form = $default + $form; + $form['default_video_thumbnail'] = array( + '#title' => t('Default video thumbnail'), + '#type' => 'managed_file', + '#description' => t('If use default thumbnanil is selected, this image will be shown on display.'), + '#default_value' => $widget['settings']['default_video_thumbnail'], + '#upload_location' => 'public://default_video_thumbnail/', + '#weight' => 19, + ); return $form; } -- cgit v1.2.3