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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

szantog’s picture

Status: Active » Needs review
FileSize
3.45 KB

The first idea.

szantog’s picture

Add this function to internet submit.

szantog’s picture

And reroll the pach because of a false rebase..

dddave’s picture

Status: Needs review » Needs work

Without testing but I cannot fathom that the patch still applies after all what has changed. Is this still relevant/necessary?

dddave’s picture

Issue summary: View changes

Add another use case

Chris Matthews’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

Closing 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