You are here

function _video_upload_form in Video 5

Same name and namespace in other branches
  1. 6 types/video_upload/video_upload.module \_video_upload_form()
  2. 6.2 types/video_upload/video_upload.module \_video_upload_form()

Create video upload specific form fields

1 call to _video_upload_form()
video_upload_v_form in types/video_upload/video_upload.module
Implementation of hook_v_form()

File

types/video_upload/video_upload.module, line 357
Enable Uploaded videos support for video module.

Code

function _video_upload_form(&$node) {
  _video_upload_check_settings();
  $form = array();
  if ($node->new_video_upload_file) {

    // there is a newly uploaded file (this has been initialized by _prepare())
    $form['new_video_upload_file_fid'] = array(
      '#type' => 'hidden',
      '#value' => $node->new_video_upload_file->fid,
    );
    $form['new_video_upload_file_info'] = array(
      '#type' => 'item',
      '#value' => theme('video_upload_file_info_form', $node->new_video_upload_file, $node),
      '#weight' => -10,
    );
    $we_have_video = true;
  }
  else {
    $form['new_video_upload_file_fid'] = array(
      '#type' => 'hidden',
      '#value' => 0,
    );
    if ($node->current_video_upload_file) {

      // we don't have a new file
      $form['current_video_upload_file_fid'] = array(
        '#type' => 'hidden',
        '#value' => $node->current_video_upload_file->fid,
      );
      $form['current_video_upload_file_info'] = array(
        '#type' => 'item',
        '#value' => theme('video_upload_file_info_form', $node->current_video_upload_file, $node),
        '#weight' => -10,
      );
      $we_have_video = true;
    }
  }
  $form['video_upload_file'] = array(
    '#type' => 'file',
    '#title' => $we_have_video ? t('Replace with') : t('Upload video file'),
    '#size' => 40,
    '#weight' => -9,
    '#description' => t('Choose a video file from your pc.<br /><b>NOTE:</b> The max upload size is') . ' ' . format_size(file_upload_max_size()) . '.',
  );
  return $form;
}