You are here

function video_field_default_thumbnail_validate in Video 7

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

Element specific validation for video default value.

1 string reference to 'video_field_default_thumbnail_validate'
video_default_field_settings in ./video.module

File

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

Code

function video_field_default_thumbnail_validate($element, &$form_state) {
  $settings = $form_state['values']['field']['settings'];

  // Make the file permanent and store it in the form.
  if (!empty($settings['default_video_thumbnail']['fid'])) {
    $file = file_load($settings['default_video_thumbnail']['fid']);
    $file->status |= FILE_STATUS_PERMANENT;
    $file = file_save($file);
    $form_state['values']['field']['settings']['default_video_thumbnail'] = (array) $file;
  }
}