Follow-up from #2230097: Add a hook for accessing profiles at IMCE load time.

In addition to manipulating the profiles, in order to use IMCE as a (kinda sorta) file field widget, the file field / custom entity must be able to delete files that the entity is managing. Again, I did this by adding an alter hook rather than changing any logic within IMCE.

This hook, hook_imce_delete_file_alter(), allows its implementations to remove files from the files-in-use list. Once that list is empty, IMCE allows the file to be deleted.

Files: 

Comments

jmarkel’s picture

StatusFileSize
new652 bytes

Here's the patch, adding the alter hook.

chapabu’s picture

Status:Active» Needs review
StatusFileSize
new1.05 KB

The hooks works perfectly, but if we're adding hooks they should be documented in imce.api.php.

This updated patch adds an imce.api.php file with an example implementation of hook_imce_delete_file_alter().

chapabu’s picture

Version:7.x-1.8» 7.x-1.x-dev
chapabu’s picture

StatusFileSize
new1.05 KB

Whoops, there was a stupid error in my example. This patch is not quite so embarrassing.