Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Currently there is a bunch of code in Media to integrate with the multiform.module to allow editing of multiple files at once. This integration needs to be updated for the 2.x branch.
- The media_media_operations() function needs to be updated to hook_file_operation_info() and also remove the delete operation which is already provided by file_entity.
- The media_forms() hook needs to be updated to use the file entity forms.
- The media_page_multiedit needs to be updated to use the file entity forms and also respect file access.
Comment | File | Size | Author |
---|---|---|---|
#15 | 1396490-multiedit-media.patch | 5.38 KB | agentrickard |
#10 | 1396490-multiedit-media.patch | 5.77 KB | agentrickard |
#5 | 1396490-multiedit-media.patch | 4.84 KB | agentrickard |
#4 | 1396490-multiedit-file-entity.patch | 465 bytes | agentrickard |
#4 | 1396490-multiedit-media.patch | 4.85 KB | agentrickard |
Comments
Comment #1
Dave Reid- Also remove hook_media_operations from media.api.php since this is now handled by File entity.
Comment #2
Dave ReidLikely we should also switch to something more useful like file/edit-multiple?fids[]=1&fids[]=2&fids[]=3 for the multiedit page as well rather than putting it as a fake menu router item.
Comment #3
agentrickardWorking on it.
Comment #4
agentrickardHere's a first pass. Some issues:
* I think this all needs to move to File Entity now, instead of Media.
* Multiform module won't let me override the default redirect issued by file_entity_edit_submit(), which is a problem.
* It doesn't work on the Thumbnail page, because that page seems to be passing bad file ids.
Note that this is currently two patches, one to Media and one to File Entity.
Agree to move all the code to File Entity?
Comment #5
agentrickardLeft a debug in one of the patches.
Comment #6
Dave ReidI don't actually. Ideally file_entity is the code that we can move into file.module in core for D8 and this functionality wouldn't fly. Media is the home for 'additional' UI stuff like this, so we should patch File entity only where needed.
Comment #7
agentrickardOK, so the only file entity patches needed here are to:
* Support the "redirect" parameter of file_operations_info(), which was in the original code.
* Allow proper redirection on save, which we can try to make work elsewhere.
Comment #8
Dave ReidThe redirection issue is very likely a multiform issue since we use the proper method and redirect only using $form_state['redirect'] in the submit handler of file_entity_edit.
I'm not sure we actually need the 'redirect' parameter for hook_file_operations_info(). Can't the callback function call drupal_goto() itself?
Comment #9
agentrickardIt could. I tried that once. If the File Entity API doesn't want (or need) a redirect option here, I can make that happen.
Comment #10
agentrickardHere's a new patch that leave File Entity alone and fixes the thumbnail and redirect problems.
Hooray!
Usage (for other modules) is in the format:
Where each number is a file id.
Comment #11
Dave ReidMerged #1305412: Depricated callback brakes multiforms into this issue.
Comment #12
agentrickardI was just looking at some contrib code, and it's too late to rename
media_multi_load()
, since it's already being called as an API function.Comment #13
Dave ReidThis is probably why it would be good to pass them in the query string instead. What module is using that function?
Comment #14
agentrickardI don't see how the query string helps in that case, if other modules are already passing arguments, they would still fail.
Comment #15
agentrickardUpdated patch that restores the old API.
Comment #16
Dave ReidTested and pushed #15 to Git and am now working on some small cleanups as a follow-up.
http://drupalcode.org/project/media.git/commit/e51372e
Comment #17
Dave ReidCompleted cleanup with http://drupalcode.org/project/media.git/commit/fc496b3. Thanks agentrickard!