Problem
The media object building is hardcoded in media_add_upload_multiple_submit() and media_add_upload_submit(). Other modules could only modify the uploaded file via own form_submit. This causes as many file_load - file_save, as many modules want to apply own changes.
The real example is the Media browser plus. It build own form, put it into the media upload form, then call its submit with file_load to save Tags values.
Another use case: I add my own fields to image, like photographer. I want to let users edit it during upload. I added the fields via _form_media_add_upload_alter. But if I want to save, I need to add one more form submit, with file_load, and file_save.
Possible solution
I think, need to move out file object building process from media form submits, and let other modules alter to modify file object and destination, then move, or just save the file object only one time.
Comment | File | Size | Author |
---|---|---|---|
#3 | 1283000_3_remove_media_building.patch | 3.8 KB | szantog |
#2 | 1283000_2_remove_media_building.patch | 4.1 KB | szantog |
#1 | 1283000_1_remove_media_building.patch | 3.45 KB | szantog |
Comments
Comment #1
szantog CreditAttribution: szantog commentedThe first idea.
Comment #2
szantog CreditAttribution: szantog commentedAdd this function to internet submit.
Comment #3
szantog CreditAttribution: szantog commentedAnd reroll the pach because of a false rebase..
Comment #4
dddave CreditAttribution: dddave commentedWithout testing but I cannot fathom that the patch still applies after all what has changed. Is this still relevant/necessary?
Comment #4.0
dddave CreditAttribution: dddave commentedAdd another use case
Comment #5
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedClosing this issue as outdated. However, if you think this issue is still important, please let us know and we will gladly re-open it for review.
sincerely,
- the Drupal Media Team