I’ve a handful of file fields which have the next default Drupal conduct:
- Person can add a file
- Person can add one other file in place
- Person can take away file
Normal config. Whats taking place is the person desires the file being changed to be deleted earlier than the brand new one is uploaded, and thus, avoiding the difficulty the place information have their names changed with _N identifiers to make sure distinctive filenames.
It is because they’re referencing bodily file paths from the menu and WYSIWYG fields – which suggests the outdated changed file is being referenced as an alternative of the brand new one. Since these are core file fields and over 100 information have been uploaded, I can’t change out to a Media subject. I am additionally undecided if that will even remedy the issue at hand, anyway.
Is there any means I can hook into this widget by way of kind alter, detect a click on on the add subject, and if a brand new file is being added, delete the outdated one in place in order that the file being uploaded the title stays intact and thus preserving hyperlink targets?
I’ve regarded on the kind with each hook_form_alter
and hook_field_widget_form_alter
– however I’m not actually seeing something I can use to hook into.