Remove existing image from existing node without replacing it.
simon rawson - December 26, 2005 - 01:31
| Project: | Flexinode |
| Version: | HEAD |
| Component: | User interface |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Description
I have searched the site and this projects issues but I can't find any answers to this. Has the removal of an uploaded image of file from a flexinode not been included in the interface? Any workarounds available?
Thanks for help,
Simon

#1
This is a bug. Its not possible atm.
#2
Related? If an image is required, but already exists, editing the flexinode requires that you replace the exisitng image. You should be able to edit the flexinode without uploading an image each time (if the required image is already submitted).
#3
bomarmonk: related, yes, but please file a separate issue for that.
#4
I'm attaching a patch to fix this issue. The basic idea is:
* In flexinode_field_image_form() incorporate the existing file form element into a fieldset that, once a file has been uploaded, also cotains a delete checkbox
* When an image has been uploaded and the form is submitted, flexinode_field_image_execute() checks to see if delete has been checked, and if so calls flexinode_field_image_delete() (an existing function).
The patch works against the HEAD version of flexinode. I've checked it against the coding conventions and it seems to be OK - but bear in mind I'm a relative rookie!
#5
Doh! forgot to attach the patch. Here it is.
#6
Some things to do:
Don't use an empty description, and never surround it with a t(): #description' => t('')
Consistently use single quotes for simple strings: '#title' => t("File")
Consistently use spaces around concatanations: $fieldname . '-remove'
In general: the idea is good, the code needs attention.