--- field_image.inc 2006-06-18 22:25:55.000000000 +0100 +++ field_image.inc.new 2006-06-18 22:31:12.000000000 +0100 @@ -21,13 +21,28 @@ function flexinode_field_image_form($fie '#value' => serialize($node->$fieldname), ); } + $form[$fieldname] = array( - '#type' => 'file', + '#type' => 'fieldset', '#title' => t($field->label), + '#description' => t(''), + '#weight' => $field->weight, + ); + + + $form[$fieldname][$fieldname] = array( + '#type' => 'file', + '#title' => t("File"), '#description' => ($node->$fieldname ? t('"%filename" has been uploaded. If you upload another file, the current file will be replaced.', array('%filename' => $node->$fieldname->filename)) : '') .' '. t($field->description) .' '. t('The file is limited to %kbKB and a resolution of %wxh pixels (width x height).', array('%wxh' => $field->options[1], '%kb' => $field->options[4])), '#required' => $field->required, - '#weight' => $field->weight, ); + if ($node->$fieldname) { + $form[$fieldname][$fieldname . '-remove'] = array( + '#type' => 'checkbox', + '#default_value' => 0, + '#title' => t('Delete'), + ); + } return $form; } @@ -107,7 +122,13 @@ function flexinode_field_image_execute($ return $file; } elseif(empty($node->$fieldname)) { + if ($node->{$fieldname . '-remove'}) { + flexinode_field_image_delete($field, $node, 0) ; + return ''; + } + else { return unserialize($node->{$fieldname .'_old'}); + } } }