Support from Acquia helps fund testing for Drupal Acquia logo

Comments

thebruce’s picture

I can confirm this is also happening to me - latest media dev branch - prevents the behavior we used to have with media multiselect and bulk uploads on individual fields.

I think this change is likely the move from a very simple media_widget_form. The old return from that function, the small widget was rebuilt for the total number of files within a media field (+ one for a blank) -however, the changes in media have modified that form widget quite a bit and add in custom mutliple value handling. Now when that widget is called multiple times it now rebuilds an object that media multi-select is no longer prepared to deal with. Essentially the nested values are doubly nested now.

Tony Finlay’s picture

Just wondering if there was any further update on this issue or a workaround?

Cheers

ParisLiakos’s picture

mehotkhan’s picture

same problem here :S

dehacker’s picture

We really appreciate what media multiupload does to modernize the media experience. Please fix this module to work with the new media module. I hope you can get this media multiupload out of sandbox, but I will create another issue for that request.

mpotter’s picture

I echo the importance of this. Maybe this is finally the time to get the code from media_multiselect into the Media module directly as a submodule so major changes to Media don't break this functionality. Our clients really expect to be able to upload multiple files at once.

This issue is currently a blocker for updating the version of Media used in the Open Atrium 2 distribution.

mpotter’s picture

Sorry, for some reason I thought I was posting to an issue in the Media issue queue. Is there any issue over there to ask them to integrate this module that I can respond to. Not sure this will get the attention it deserves here.

b.bosiljcic’s picture

I successfully downgraded from media-7.x-2.0-alpha3+78-dev straight to media-7.x-2.0-alpha3+25-dev, this unbreaks the media multiselect module.

jmuzz’s picture

Status: Active » Needs review
FileSize
13.73 KB

Here's a patch that seems to get it working with the latest dev versions of all the relevant modules. There may be a better way as it relies on a synchronous ajax call for each file being added.

roborn’s picture

Thanks for the patch! Seems to be working fine here, except for the weight handler.

I'v fix this by keeping the Media #process handler that builds the _weight field. Also, removed an unused var from JS.

roborn’s picture

Changed the JS selector for wrapper to make it re-usable with other modules, like https://www.drupal.org/project/media_desk

roborn’s picture

The .form-wrapper needs to be more specific.

PI_Ron’s picture

Can confirm patch in #12 removes the error nicely.

loze’s picture

Also confirming that patch in #12 works.

brockfanning’s picture

Does #12 depend on another patch? I'm having trouble getting it to apply.

brockfanning’s picture

I'm a little confused why #12 would not be applying, given that there have not been any recent commits. But anyway, if #12 fails to apply for anyone else, you can try this hand-edited reroll. (Though I'd still try #12 first).

ergophobe’s picture

#12 applied cleanly for me, but I just get the standard media browser, not the multiselect/plupload widget.

I've tried it with Media 7.x-2.0-alpha3+98-dev (Panopoly version) and current dev (+100).

The latest version of Media I can get to work with multiselect is still alpha3+37-dev.

Rob C’s picture

Status: Needs review » Needs work

I experience the same as #17. Cache clear, rr, etc, doesnt fix a thing.
What media 2.x version are you guys using? Is this on an already installed site or a fresh install?

loze’s picture

plupload and multiform need to be enabled. Then select "media multiselect" for your field widget.

ergophobe’s picture

To clarify, I have it working fine with

Media 7.x-2.0-alpha3+37
Plupload 7.x-1.6
Multiform 7.x-1.0

This issue is about getting it to work with the "most recent" version of Media. I have found that if I upgrade beyond Media 7.x-2.0-alpha3+37, Media Multiselect no longer works.

Part of the problem is that "most recent" is ambiguous and I was trying to find out which version (commit hash or alpha3+??? number) does this patch work with.

Rob C’s picture

The current branch is 7.x-1.x (master still exists).

""most recent" is ambiguous"

Agreed. I would prefer to have git commit id's etc and not alpha3+dev123, then we can really set a target.

We tried another issue a while back for this module the same way, and if the media module or core changes things again, then we again need to change media multiselect.

Patch in #16 applies, but does not fix my issue, the multiselect is (still) broken with media 2.x HEAD and thus, ambiguous ...

ergophobe’s picture

To provide one signpost...

Media 7.x-2.0-alpha3+37 (dated 2014-05-22) is I believe commit df4cccc4e2fd401fc4ce43085aeb6af264992d30 which reverts the previous commit.

mglaman’s picture

#16 fixes the issue where a field utilizing multi select has proper browser plugins and can insert. However it only inserts one file at a time.

mglaman’s picture

So, I've been doing some research. This is definitely caused by #2187837: Bring media element and field widget inline with managed_file equivalents. I don't think the sandbox's current approach will work anymore. Due to how the widget it built it won't trigger multiple submits the same way, causing only one value to be added at a time.

migueltrindade’s picture

Yes!!!!.... #12 works for me.

I'm using:
Media 7.x-2.0-alpha3+98-dev from Panopoly.
Plupload 7.x-1.6
Multiform 7.x-1.1

Thanks!

ergophobe’s picture

#12 works for me now that I've upgraded Multiform to 1.1. I don't know if that was causing the issue before, but seems to work fine now.

Media 7.x-2.0-alpha3+98-dev from Panopoly and with Media 7.x-2.0-alpha3+108-dev
Plupload 7.x-1.6
Multiform 7.x-1.1

I've also applied the patch for #2192981: Restore media field widget edit button and everything works fine (except with Panels, but that's a Media issue, not a Media Multiselect issue)

mglaman’s picture

ergophobe, did you get #12 to work with Panopoly and having Multiform 1.1? We currently had to re-declare Media in our makefiles for it to work, because I couldn't get either of these patches to cooperate.

ergophobe’s picture

mglaman - Yes. I just updated from Panopoly 1.6 to Panopoly 1.11, updated Multiform and it worked. I also tried the latest Media dev relears and applied the patch mentioned above thinking it would probably kill the whole thing, but it actually works great in general. There is the problem I'm having with #2333247: Image and Media upload widgets broken when using Panels, but that problem exists with the standard Media Browser and, I just discovered, with a standard Image widget and Filefield Sources + Plupload, so I'm going to move that issue to Panels since it's not limited to Media at all, let alone Multiselect.

I only have it locally and about to head out to spend the day outdoors, but I can push it to a test server this evening and give you admin access if you want to poke around if you think that would be helpful. Drop me an email through the contact form if you want access.

jmuzz’s picture

I did say most recent dev version, but I am pretty sure I was actually using the repository versions. To checkout the code I had at the time use:

git checkout `git rev-list -n 1 --before="2014-08-10 13:37" 7.x-2.x`

Replace 7.x-2.x with the branch names for the individual projects.

I found this method at http://stackoverflow.com/questions/6990484/git-checkout-by-date .

I hope that helps with some of the ambiguity.

ergophobe’s picture

Strangely, this is now giving me javascript errors. When I enable Multiselect I get this

An error occurred while attempting to process /media/ajax/field_additional_images/und/form-WAokasdfasfeasdfasdf: undefined is not a function

ergophobe’s picture

Hmm... this s curious. I noticed it was throwing that error inconsistently. So I recreated the content type that was having the problems and the problem went away until I enabled Filefield Paths. Then it came back. But here's the strange part, if I disable Filefield Paths on the field, the error remains.

If delete the field and add it back (by adding the existing field, since it still exists in the original content type), the error is still there.

In Firefox I get this error (the previous one was in Chrome)

An error occurred while attempting to process /media/ajax/field_gallery_images/und/form-bCEvC2u-yOFjbC0jPgrryd8eapUbj8uaHuHoGhwNvNc: Drupal.navbar.height is not a function

For some content types I can force the error, but for others I can't and I can't quite figure out what's different from one to the next, but if I switch from Multiselect to the normal Media Browser, it goes away.

Very strange

UPDATE
Stranger still, it turns out to be an issue with a setting on the Organics Groups reference widget. If I set the Admin widget to something other than Autocomplete. I get this error.

kporras07’s picture

Added patch that works for me. The other ones didn't apply in my env.

mpotter’s picture

FileSize
36.41 KB

Not sure if this is the same problem as #30 or #31, but I am getting a popup error after it tries downloading each file:

An error occurred while attempting to process /media/ajax/field_oa_media/und/form-iP78tKh0sRJ8uWmmJCLJwAV-YJLyZQmJm2JgAAbBWow: Cannot read property 'mouseover' of undefined

After attaching one file, there is an extra text field below it and the buttons for attaching more images don't work as shown in the screenshot.

Using Media from Panopoly 1.11, multiform 1.1, plupload 1.6, latest dev of media_multiselect.

mpotter’s picture

Status: Needs work » Needs review

Oh wow, nevermind!! It was code in oa_dashboard.js in Open Atrium that was causing this problem. It's checking for some drupal settings that are not passed to javascript when it calls the attach behaviors after the ajax.

After fixing oa_dashboard (which should be updated soon), then media_multiselect started working just fine with the patch in #12 or #32. Marking this for more review.

Sorry for the false alarm!

AndrewTur’s picture

Hi I have updated to the latest dev of the media module the 7.x-2.0-alpha3+114-dev and got the same problems as mentiont above. Only one image is being added with the patch in #12 applied.

ergophobe’s picture

mpotter - do you have a link to the OA issue related to this 9if there is one)? It might be helpful to see if there's similar code in the OG reference widget problem.

Anonymous’s picture

With:

Media 7.x-2.0-alpha3+115-dev
Plupload 7.x-1.6
Multiform 7.x-1.1

#16 works, whereas #12 failed to apply

However, in /admin/modules, Media Multiselect no longer shows a version.

drush pm-info output:

date_timezone_set() expects parameter 1 to be DateTime, boolean given common.inc:2008 [warning]
date_format() expects parameter 1 to be DateTime, boolean given common.inc:2018 [warning]
Extension : media_multiselect
Project : Unknown
Type : module
Title : Media Multiselect
Description : Provides a multiselect Media functionality
Date :
Package : Media
Core : 7.x
PHP : 5.2.4
Status : enabled
Path : sites/all/modules/media_multiselect
Schema version : module has no schema
Files : none
Requires : media
Required by : none
Permissions : none
Configure : None

legolasbo’s picture

The patch in #12 applied cleanly and worked perfectly, both on my dev environment on OSX and my production environment on CentOS using patch -p1 < media_multiselect-update_for_new_media-2216273-12.patch from the media_multiselect directory.

Rob C’s picture

Status: Needs review » Needs work

I'm a lil lost. I see commits on 'master' (still has to be deleted) and 7.x-1.x.

32 applies clean to master
12 applies clean to master

Last commit is done on 7.x-1.x (and 2 commits ahead of master).

Result from 12:
( ! ) Fatal error: Unsupported operand types in htdocs/sites/all/modules/contrib/media_multiselect/media_multiselect.module on line 161

Result from 32:
( ! ) Fatal error: Unsupported operand types in htdocs/sites/all/modules/contrib/media_multiselect/media_multiselect.module on line 159

(both on *current* media 7.x-2.x) (just did a checkout from git)

mglaman’s picture

I'm with Rob C on this one, I don't get how people are having this work. The way the widget works doesn't make sense to work with the original hack. Unless there is a specific Media revision ya'll using.

legolasbo’s picture

@mglaman I've got this working with Media 7.x-2.0-alpha4 using patch from #12

mglaman’s picture

@legolasbo awesome, thanks! I didn't see a new alpha was cut, perhaps something got fixed up from when I tried. Field widget logic change to bring it inline with file widget made things go nuts. Perhaps some kind of fix got implemented.

Jean Gionet’s picture

Media 7.x-2.0-alpha4 using patch from #12 also worked for me! thanks

mglaman’s picture

Status: Needs work » Needs review

Marking needs review. Realizing patch #16 doesn't match the patch in #12. For some reason Drush really doesn't like #12, but manually applied is OK.

Testing now with #12 manually, hiding #16 since it's a faulty patch. Link to patch diff https://www.diffchecker.com/4cz59lqr

One issue I'm having, is that media_multiselect_ajax_submit() is never being called with any of the patches. Not sure if it's just my setup, but any insight would be great.

mglaman’s picture

Linking to ticket in Media - #951004: Allow selecting of multiple media items for a multi value media field in the same dialog. Implements this functionality in main module.

msound’s picture

comment deleted, no relevant to media_multiselect module.

msound’s picture

When uploading multiple images, I see duplicate thumbnails. I have uploaded a patch for this on media module. Linking it here for reference: https://www.drupal.org/node/2093435#comment-9364947

sheldonkreger’s picture

@mglaman Great idea to port this functionality to Media Module itself. I'm a supporter ;-)

rcodina’s picture

@mglaman Thanks for the link to the other issue. Using patch on comment #77 of that issue I managed to have plupload with Media 7.x-2.0-alpha4+11-dev. If anyone is interested, you can find more details about my environment here.

Rob C’s picture

I can confirm #49 rcodina's findings!

Media multiselect is not required anymore for multi value file fields. Please all test the latest media 2.x + file entity + the patch from:
#951004: Allow selecting of multiple media items for a multi value media field in the same dialog

msound’s picture

When I upload a lot of files (approx 100), I am maxxing out php's max_input_vars default limit of 1000. This patch removes AJAX HTML IDs from the post data, so I stay within the 1000 input vars limit. Note, this patch is based on #12.

msound’s picture

In continuation to patch #51 here is an improvement where jquery_version is added conditionally (if jquery update module is enabled).

SocialNicheGuru’s picture

This doesn't apply to the latest media_multiselect.

git apply media_multiselect-update_for_new_media-2216273-52.patch
error: patch failed: media_multiselect.module:77
error: media_multiselect.module: patch does not apply

patch -p1 < media_multiselect-update_for_new_media-2216273-52.patch
patching file media_multiselect.js
patching file media_multiselect.module
Hunk #2 FAILED at 77.
Hunk #3 FAILED at 92.
Hunk #4 FAILED at 148.
Hunk #5 succeeded at 219 (offset 3 lines).
Hunk #6 succeeded at 234 (offset 3 lines).
Hunk #7 succeeded at 274 (offset 3 lines).
Hunk #8 succeeded at 288 (offset 3 lines).
Hunk #9 succeeded at 309 (offset 3 lines).
Hunk #10 FAILED at 323.
Hunk #11 succeeded at 344 (offset 4 lines).
4 out of 11 hunks FAILED -- saving rejects to file media_multiselect.module.rej

ergophobe’s picture

To reiterate Rob C's comment, most of us are having much better luck by using the patch here:

#951004: Allow selecting of multiple media items for a multi value media field in the same dialog

It applies cleanly and works flawlessly on the latest dev of Media.

PI_Ron’s picture

ergophobe... Legend.

ergophobe’s picture

Thank mglaman for that patch. The patch *is* great though - the solution I've been looking for for Drupal ever since version 4.6.

erykmynn’s picture

#52 applies cleanly to my version (Approx Feb 28, 2014) and resolves issues with multiselect fields on both new nodes and when editing existing. Thank you!

momchil_brashnyanov’s picture

This patch applies the changes from #12 to the 7.x-1.x branch.

joseph.olstad’s picture

Patch #58 works for us so far, however I did need an additional patch to the 'media' module

See my comment at issue #951004 .

RTBC #58

joseph.olstad’s picture

The media_multiselect module is deprecated by the newer media 7.x-2.0 beta and higher and the multiform module latest release