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.
I would love to have the widget as replacment for the default media "Select media"-upload where I only
Or an integration in the "Media file selector"-Widget like it appears at ".../file/add".
Comment | File | Size | Author |
---|---|---|---|
#8 | media-upload-widget--1476830-8.patch | 1.32 KB | anon |
#2 | media-upload-widget--1476830-2.patch | 999 bytes | jessehs |
#1 | media-upload-widget--1476830-1.patch | 1012 bytes | jessehs |
Comments
Comment #1
jessehsI'm running Media 2.0-unstable4 and I was not able to get the plupload widget to appear either by using the TinyMCE media button, which would be ideal, or even when setting a field type to Image and using the media library widget.
I think perhaps something may have changed in the Media module recently, as I didn't see any recent issues reporting this.
I'm not sure if this is the right way to approach it, or if I'm missing something entirely, but the following patch implements hook_media_browser_params_alter in order to set the multiselect param to TRUE. It's set to FALSE by default in media.browser.inc.
This could be extended with a set of variables to determine the circumstances where multivalues should be enabled. One of the params is the widget that instantiated the browser.
Patch attached.
Comment #2
jessehsWhoops, the description for the params variable was wrong.
Comment #3
slashrsm CreditAttribution: slashrsm commentedThis feature was broken by #1552920: Move file/add from media to file.. Issue to fix this is #1599892: Plupload integration broken.
Comment #4
drzraf CreditAttribution: drzraf commentedthe patch does the trick in a pretty way.
the only sad thing (not related to this issue) is that the first one of multiple uploaded items only get submitted to the node.
other than that it works well.
Comment #5
fangel CreditAttribution: fangel commenteddrzraf: That is very much related to this issue.
The patch just fools the Media-browser into thinking that the user asked it to select multiple files. This makes the upload dialog use PLUpload, that's correct. But the widget that lunched the dialog browser is only expecting to get one image back (because that's what it asked for, the dialog was just tricked into thinking otherwise by the alter-hook). This is why it only selects the first image uploaded, because that's what the widget asked for: one file.
So imho this is a pretty pointless way of solving this problem.
I believe the PLUpload integration module should try and replace the 'file/add'-page that file_entity provides since 7.x-2.x-unstable4 with a PLUpload page that allows the user to upload multiple files in a row. These can then be selected one-by-one by the media browser.
In the longer run, I believe the Media file browser widget should be updated to use a custom multi-value behaviour so it can correctly ask for more than one file at a time, which also enables PLUpload in the browser dialog.
Comment #6
fangel CreditAttribution: fangel commentedOkay, PLUpload on 'file/add' actually exists, it just requires the multiform-module as well. So nevermind that.
But my point about changing the widget to allow multi-selects still stands, as I believe this is a much better way of doing it.
Comment #7
slashrsm CreditAttribution: slashrsm commentedWidget changes should be implemented in Media, so I'm closing this.
Comment #8
anonMedia does not have any settings for multipe.
Its actually enforce multiple = FALSE
so I dont see why this module couldn't alter the widget.
I have tested the patch in #2 and I dont think its a good idea to apply this on all fields. It should be a field instance setting.
See my patch.
Comment #9
slashrsm CreditAttribution: slashrsm commentedThis will only enable Plupload in media selector popup. That was never a problem. The problem is, when you want all uploaded files to appear in field after upload. That would not work and it is much harder to achieve.
Comment #10
fangel CreditAttribution: fangel commentedFor what it's worth, I have an experimental sandbox module, that provides a multiselect widget to Media. That enables plupload (and multiselection from your library) and selects all the files you chosen, not just the first one. You're welcome to test it out and report back.. (It only works with unlimited cardinality right now)
http://drupal.org/sandbox/fangel/1652676
Comment #11
slashrsm CreditAttribution: slashrsm commentedThis module looks great. It is a long requested feature and I believe it will get a lot of attention. Were you thinking about contributing this to Media? I think it would be great to have this there.... Maybe you should try to contact Dave Reaid on IRC to get his feedback about this topic.
I had some problems when testing it. Will post an issue in sandbxes issue queue.
Comment #12
fangel CreditAttribution: fangel commentedslashrsm: Thanks for the kind words. As stated on the sandbox page, the hope is to prove that this is a viable way to do it, get all the kinks worked out, and then hopefully get it merged into Media itself - yes.
Comment #13
slashrsm CreditAttribution: slashrsm commentedThat sounds great! I'll try to test and give feedback as much as I can.