You are here

function video_presave in Video 6

Implementation of hook submit

2 calls to video_presave()
video_insert in ./video.module
Implementation of hook_insert. Create video record in the video table
video_update in ./video.module
Hook

File

./video.module, line 722
video.module

Code

function video_presave(&$node) {
  if (video_support_autoresolution($node) && $node->new_video_upload_file_fid) {

    // vtype support autoresolution getting
    $xy = module_invoke('video_' . $node->vtype, 'v_auto_resolution', $node);
    if ($xy) {
      $node->videox = $xy[0];
      $node->videoy = $xy[1];
    }
  }
  else {

    // if you have a existing value from hidden field
    if ($node->hvresolution) {
      $res = explode('x', $node->hvresolution);
      $node->videox = $res[0];
      $node->videoy = $res[1];
      $node->size = $node->hsize;
    }
    else {
      $res = explode('x', variable_get('video_resolution_' . $node->vresolution . '_value', ''));
      $node->videox = $res[0];
      $node->videoy = $res[1];
    }
  }
  if (video_support_autoplaytime($node) && $node->new_video_upload_file_fid) {

    // vtype support auto playtime
    $node->playtime_seconds = module_invoke('video_' . $node->vtype, 'v_auto_playtime', $node);
  }
  else {

    // vtype does not support auto_playtime
    $node->playtime_seconds += $node->playtime_hours * 3600 + $node->playtime_minutes * 60;
  }
}