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.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

- Also remove hook_media_operations from media.api.php since this is now handled by File entity.

Dave Reid’s picture

Likely 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.

agentrickard’s picture

Assigned: Dave Reid » agentrickard

Working on it.

agentrickard’s picture

Status: Active » Needs work
FileSize
4.85 KB
465 bytes

Here'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?

agentrickard’s picture

Left a debug in one of the patches.

Dave Reid’s picture

I 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.

agentrickard’s picture

OK, 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.

Dave Reid’s picture

The 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?

agentrickard’s picture

It could. I tried that once. If the File Entity API doesn't want (or need) a redirect option here, I can make that happen.

agentrickard’s picture

Status: Needs work » Needs review
FileSize
5.77 KB

Here'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:

admin/content/file/multiedit/1+2+3+47

Where each number is a file id.

Dave Reid’s picture

agentrickard’s picture

Status: Needs review » Needs work

I 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.

Dave Reid’s picture

This is probably why it would be good to pass them in the query string instead. What module is using that function?

agentrickard’s picture

I don't see how the query string helps in that case, if other modules are already passing arguments, they would still fail.

agentrickard’s picture

Status: Needs work » Needs review
FileSize
5.38 KB

Updated patch that restores the old API.

Dave Reid’s picture

Assigned: agentrickard » Dave Reid

Tested 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

Dave Reid’s picture

Status: Needs review » Fixed

Completed cleanup with http://drupalcode.org/project/media.git/commit/fc496b3. Thanks agentrickard!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.