Index: imagefield.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/imagefield/imagefield.module,v retrieving revision 1.30.2.6.2.43 diff -u -p -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 25 Feb 2008 03:22:30 -0000 @@ -638,8 +638,12 @@ function _imagefield_widget_form($node, '#suffix' => '', '#weight' => 100, ); - - if ($field['multiple'] && count($items) < $field['widget']['max_number_images']) { + + //Series of tests to see if we're allowed to add a new image + $allowed = ($field['multiple'] && count($items) < $field['widget']['max_number_images'] ? TRUE : $allowed); + $allowed = ($field['multiple'] && 0 == $field['widget']['max_number_images'] ? TRUE : $allowed); + $allowed = (!$field['multiple'] && count($items) < 1 ? TRUE : $allowed); + if ($allowed) { // 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( @@ -663,7 +667,12 @@ function _imagefield_widget_form($node, 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'])); + if (!$field['multiple'] || $field['widget']['max_number_images'] == 1) { + $form[$fieldname]['new']['#value'] = t('You can only attach a single image to this field. Delete the existing image if you wish to be able to upload a different image.'); + } + else { + $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['widget']['max_number_images'])); + } } @@ -731,13 +740,6 @@ function _imagefield_widget_form($node, ); } - // Special handling for single value fields - if (!$field['multiple']) { - $form[$fieldname][$delta]['replace'] = array( - '#type' => 'markup', - '#value' => t('If a new image is chosen, the current image will be replaced upon submitting the form.'), - ); - } } elseif ($file['filepath'] && $file['flags']['hidden']) { // Render all the form values of this item if it is hidden.