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

CommentFileSizeAuthor
#5 flexinode-image-remove.patch.txt1.51 KBegfrith

Comments

Bèr Kessels’s picture

Category: support » bug

This is a bug. Its not possible atm.

bomarmonk’s picture

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).

Bèr Kessels’s picture

bomarmonk: related, yes, but please file a separate issue for that.

egfrith’s picture

Status: Active » Needs review

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!

egfrith’s picture

StatusFileSize
new1.51 KB

Doh! forgot to attach the patch. Here it is.

Bèr Kessels’s picture

Category: bug » feature
Status: Needs review » Needs work

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.