You are here

function scald_video_get_video_file_form in Scald: Media Management made easy 7

Returns a video file form element compatible with plupload. This function avoid repetitions over the multiple places a file upload field is needed in scald_video.

Parameters

$form_element: The form element we want to set to video file field.

2 calls to scald_video_get_video_file_form()
scald_video_form_scald_atom_add_form_options_alter in modules/providers/scald_video/scald_video.module
Implements hook_form_FORM_ID_alter().
scald_video_scald_add_form in modules/providers/scald_video/scald_video.module
Implements hook_scald_add_form().

File

modules/providers/scald_video/scald_video.module, line 323
Scald Video is a Scald Atom Provider for video files.

Code

function scald_video_get_video_file_form(&$form_element) {
  if (module_exists('plupload')) {
    $form_element = array(
      '#type' => 'plupload',
      '#plupload_settings' => array(
        'runtimes' => 'html5',
        'chunk_size' => '1mb',
      ),
    );
  }
  else {
    $defaults = scald_atom_defaults('video');
    $form_element['#type'] = $defaults->upload_type;
  }
  $form_element['#upload_validators'] = array(
    'file_validate_extensions' => array(
      'webm mp4 ogv',
    ),
  );
  $form_element['#upload_location'] = variable_get('scald_video_upload_location', 'public://atoms/video/');
}