You are here

function video_field_default_thumbnail_validate in Video 7.2

Same name and namespace in other branches
  1. 7 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_field_settings_form in ./video.field.inc
Implements hook_field_settings_form().

File

./video.field.inc, line 222
Implement a 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;
  }
}