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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jessehs’s picture

Status: Active » Needs review
FileSize
1012 bytes

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

jessehs’s picture

Whoops, the description for the params variable was wrong.

slashrsm’s picture

Status: Needs review » Active
drzraf’s picture

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

fangel’s picture

drzraf: 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.

fangel’s picture

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

slashrsm’s picture

Status: Active » Closed (works as designed)

Widget changes should be implemented in Media, so I'm closing this.

anon’s picture

Status: Closed (works as designed) » Needs review
FileSize
1.32 KB

Media does not have any settings for multipe.
Its actually enforce multiple = FALSE

  $params = drupal_get_query_parameters() + array(
    'types' => array(),
    'multiselect' => 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.

slashrsm’s picture

Status: Needs review » Closed (works as designed)

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

fangel’s picture

For 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

slashrsm’s picture

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

fangel’s picture

slashrsm: 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.

slashrsm’s picture

That sounds great! I'll try to test and give feedback as much as I can.