Skip to content

Deleting an attachment #8

@akalra

Description

@akalra

Hi --

I was about to go add support for deleting an attachment, but not sure what approach makes the most sense.

For any other field type (text/etc), the current value gets rendered to the form and you can edit it out to communicate to the controller that you want to unset it.

For file field types, the current value doesn't really get rendered. We can render the attachment URL or image out of band, but it's not native to the input type. There doesn't appear to be a way to populate the input with an 'unset' type value, so there's no clear way to communicate to the controller in a standard way to unset the attribute.

The best practice appears to be to render a 'delete'/'unset' checkbox or similar, and check for that value in the controller. However, this would require the controller to cooperate with the field's custom checkbox semantics, which breaks the nice abstraction we have with fields in Administrate.

Thoughts?

Ankur

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions