You are here

function fupload_list_images_image_validate in Image FUpload 6.3

1 string reference to 'fupload_list_images_image_validate'
fupload_list_images_image in includes/images.previewlist.image.inc

File

includes/images.previewlist.image.inc, line 90

Code

function fupload_list_images_image_validate($form, &$form_state) {

  // only validate body field, rest is already validated; code partially taken from function "node_validate" (D6)
  // get nids of images and start batch process (validation)
  $type = node_get_types('type', str_replace("-", "_", check_plain(arg(2))));
  $image_nids = explode(';', $form_state['values']['image_nodes']);
  for ($i = 0; $i < count($image_nids); $i++) {
    if (!empty($type->min_word_count) && isset($form_state['values']['body_' . $image_nids[$i]]) && count(explode(' ', $form_state['values']['body_' . $image_nids[$i]])) < $type->min_word_count) {
      form_set_error('body_' . $image_nids[$i], t('The body of the @img_number. image is too short. You need at least %words words.', array(
        '%words' => $type->min_word_count,
        '@img_number' => $i + 1,
      )));
    }
  }
}