Index: contrib/image_attach/image_attach.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/image/contrib/image_attach/image_attach.module,v retrieving revision 1.67 diff -u -p -r1.67 image_attach.module --- contrib/image_attach/image_attach.module 17 Sep 2009 19:01:39 -0000 1.67 +++ contrib/image_attach/image_attach.module 4 Oct 2009 11:15:32 -0000 @@ -215,26 +215,30 @@ function image_attach_form_alter(&$form, ); } } - - $form['image_attach']['iids'] = array( - '#type' => 'select', - $value => empty($node->iids) ? NULL : $node->iids, - '#multiple' => TRUE, - '#size' => 6, - // Title, options and description are set just below. - ); - - // User may attach already existing images: show a selection box containing all images. - if (variable_get('image_attach_existing', 1)) { - $form['image_attach']['iids']['#title'] = t('Existing images'); - $form['image_attach']['iids']['#options'] = _image_attach_get_image_nodes(); - $form['image_attach']['iids']['#description'] = t('Choose an image already existing on the server if you do not upload a new one.'); - } - // User may only upload new images: show a selection box containing only attached images. - else { - $form['image_attach']['iids']['#title'] = t('Attached images'); - $form['image_attach']['iids']['#options'] = _image_attach_get_image_nodes($node->iids); - $form['image_attach']['iids']['#description'] = t('You can remove a previously attached image by unselecting it.'); + + // Only show selection box of image nodes if the user may attach some, + // or if there are existings ones that may be removed. + if (variable_get('image_attach_existing', 1) || count($node->iids)) { + $form['image_attach']['iids'] = array( + '#type' => 'select', + $value => empty($node->iids) ? NULL : $node->iids, + '#multiple' => TRUE, + '#size' => 6, + // Title, options and description are set just below. + ); + + // User may attach already existing images: show a selection box containing all images. + if (variable_get('image_attach_existing', 1)) { + $form['image_attach']['iids']['#title'] = t('Existing images'); + $form['image_attach']['iids']['#options'] = _image_attach_get_image_nodes(); + $form['image_attach']['iids']['#description'] = t('Choose an image already existing on the server if you do not upload a new one.'); + } + // User may only upload new images: show a selection box containing only attached images. + else { + $form['image_attach']['iids']['#title'] = t('Attached images'); + $form['image_attach']['iids']['#options'] = _image_attach_get_image_nodes($node->iids); + $form['image_attach']['iids']['#description'] = t('You can remove a previously attached image by unselecting it.'); + } } // User may create images, add upload form elements.