You are here

function fupload_list_images_validate in Image FUpload 6

Same name and namespace in other branches
  1. 6.3 includes/images.previewlist.inc \fupload_list_images_validate()
  2. 6.2 includes/images.previewlist.inc \fupload_list_images_validate()
1 string reference to 'fupload_list_images_validate'
fupload_list_images in includes/images.previewlist.inc

File

includes/images.previewlist.inc, line 76

Code

function fupload_list_images_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', 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,
      )));
    }
  }
}