You are here

function video_field_instance_settings_form in Video 7

Same name and namespace in other branches
  1. 7.2 video.field.inc \video_field_instance_settings_form()

Implements hook_field_instance_settings_form().

File

./video.field.inc, line 75
Implement an video field, based on the file module's file field.

Code

function video_field_instance_settings_form($field, $instance) {
  $widget = $instance['widget'];
  $instance_settings = $instance['settings'];
  $settings = $instance['settings'];

  // Use the file field instance settings form as a basis.
  $form = file_field_instance_settings_form($field, $instance);

  // Remove the description option.
  unset($form['description_field']);

  // add settings by widget type
  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_instance_settings($settings);
  $form = $default + $form;
  return $form;
}