diff options
author | Heshan Wanigasooriya <heshanmw@gmail.com> | 2010-12-12 16:13:48 +0000 |
---|---|---|
committer | Heshan Wanigasooriya <heshanmw@gmail.com> | 2010-12-12 16:13:48 +0000 |
commit | eaa5a4f6e2c2feac03442184198315eb795ac282 (patch) | |
tree | 08786cc7048127837063e93b9295a56d3d503c78 | |
parent | ade7b09612e13401d154f11a3f9ef5c46b5934bc (diff) | |
download | video-eaa5a4f6e2c2feac03442184198315eb795ac282.tar.gz video-eaa5a4f6e2c2feac03442184198315eb795ac282.tar.bz2 |
Updating the video field to the save their settings.
-rw-r--r-- | video.field.inc | 57 | ||||
-rw-r--r-- | video.module | 11 |
2 files changed, 34 insertions, 34 deletions
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; } @@ -76,28 +68,6 @@ function video_field_instance_settings_form($field, $instance) { } /** - * 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(). */ function video_field_load($entity_type, $entities, $field, $instances, $langcode, &$items, $age) { @@ -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 "<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, + ); + 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; } diff --git a/video.module b/video.module index a1f5c9f..4d44270 100644 --- a/video.module +++ b/video.module @@ -12,6 +12,7 @@ module_load_include('inc', 'video', 'video.field'); /* * Implementation of hook_init(). */ + function video_init() { drupal_add_css(drupal_get_path('module', 'video') . '/css/video.css'); drupal_add_js(drupal_get_path('module', 'video') . '/js/video.js'); @@ -215,7 +216,6 @@ function video_theme() { return $theme; } - /* * Implmentation of hook_cron(). */ @@ -830,6 +830,15 @@ function video_default_widget_settings($widget) { '#type' => 'value', '#value' => $widget['default_video_thumb'], ); + +// $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' => !empty($widget['default_video_thumbnail']) ? $widget['default_video_thumbnail'] : '', +// '#upload_location' => 'public://default_video_thumbnail/', +// '#weight' => 19, +// ); return $form; } |