Index: imagefield.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/imagefield/imagefield.module,v retrieving revision 1.30.2.6.2.43 diff -u -r1.30.2.6.2.43 imagefield.module --- imagefield.module 21 Feb 2008 11:44:54 -0000 1.30.2.6.2.43 +++ imagefield.module 28 Feb 2008 09:09:28 -0000 @@ -638,8 +638,14 @@ '#suffix' => '', '#weight' => 100, ); - - if ($field['multiple'] && count($items) < $field['widget']['max_number_images']) { + + $max_images = $field['widget']['max_number_images']; + if ($field['multiple'] && $max_images && count($items) < $max_images) { + $form[$fieldname]['#prefix'] = '
'; + $form[$fieldname]['new']['#prefix'] = '
'; + $form[$fieldname]['new']['#value'] = format_plural($max_images, 'You can only attach one image to this field. Delete the image if you wish to be able to upload a different one.', 'You can only attach @count images to this field. Delete an image if you wish to be able to upload different images.'); + } + else { // Seperate from tree becase of that silly things won't be // displayed if they are a child of '#type' = form issue $form[$fieldname]['new'][$fieldname .'_upload'] = array( @@ -660,11 +666,6 @@ // The class triggers the js upload behaviour. $form[$fieldname .'-attach-url'] = array('#type' => 'hidden', '#value' => url('imagefield/js', NULL, NULL, TRUE), '#attributes' => array('class' => 'upload')); } - else { - $form[$fieldname]['#prefix'] = '
'; - $form[$fieldname]['new']['#prefix'] = '
'; - $form[$fieldname]['new']['#value'] = t('You can only attach %num images to this field. Delete an image if you wish to be able to upload different images.', array('%num' => $field['max_number_images'])); - } // @todo split following if block into its own function.