You are here

function video_widget_process in Video 6.5

Same name and namespace in other branches
  1. 6.4 video_widget.inc \video_widget_process()

Video_widget_process for API handlers for any video types.

2 calls to video_widget_process()
uploadfield_widget_process in types/uploadfield/uploadfield_widget.inc
Element #process callback function.
videoftp_widget_process in types/videoftp/videoftp_widget.inc
Process an individual element.

File

./video_widget.inc, line 181
Common Video module widget functions

Code

function video_widget_process(&$element, &$form_state) {
  $item = $element['#value'];
  $field = content_fields($element['#field_name'], $element['#type_name']);
  switch ($form_state['clicked_button']['#submit'][0]) {
    case 'node_form_submit':

    // Multistep module support
    case 'multistep_save':
    case 'multistep_next':
    case 'multistep_previous':
    case 'multistep_done':

      // Auto convert our video file
      if ($field['widget']['autoconversion']) {
        video_convert_process($element, $field);

        // Lets set our node status to unpublished if our video is not converted.
        if (isset($element['#unpublish']) && $element['#unpublish']) {

          // Unpublish the node
          $form_state['values']['status'] = 0;
        }
      }

      // Save manually uploaded thumbs (if they exist) and add them to element
      $filename = $field['field_name'] . '_' . $element['#delta'] . '_thumbs';
      if (isset($_FILES['files']) && is_array($_FILES['files']['name']) && !empty($_FILES['files']['name'][$filename])) {
        video_upload_manual_thumb($element);
      }

      // Call hook_video_submit API
      video_module_invoke('insert', $element, $form_state);

      // Queue up the file id to update the node id in the video rendering / cdn tables.
      $form_state['values']['video_id'][] = $item['fid'];
      break;
    case 'node_form_build_preview':

      // Call hook_video_preview API
      video_module_invoke('preview', $element, $form_state);
      break;
    case 'node_form_delete_submit':

      // Moved to hook_file_delete in video module.
      break;
  }
}