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.
There have been some changes to the file field browser widget. I Think this was introduced here. #2187837: Bring media element and field widget inline with managed_file equivalents
It seems that the multi select widget builds upon the single select widget. I get a lot of the single select widgets if I try to add several files to a file field at once. But if I click "Attach" I get only a huge Javascript AJAX Error.
Screenshot:
Comment | File | Size | Author |
---|---|---|---|
#58 | media_multiselect-update_for_new_media-2216273-58.patch | 12.39 KB | momchil_brashnyanov |
#52 | interdiff-2216273-12-52.txt | 1.19 KB | msound |
#52 | media_multiselect-update_for_new_media-2216273-52.patch | 15.63 KB | msound |
#33 | multiselect_problem.png | 36.41 KB | mpotter |
#32 | media_multiselect-update_for_new_media-2216273-32.patch | 11.89 KB | kporras07 |
Comments
Comment #1
thebruce CreditAttribution: thebruce commentedI 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.
Comment #2
Tony Finlay CreditAttribution: Tony Finlay commentedJust wondering if there was any further update on this issue or a workaround?
Cheers
Comment #3
ParisLiakos CreditAttribution: ParisLiakos commentedComment #4
mehotkhan CreditAttribution: mehotkhan commentedsame problem here :S
Comment #5
dehacker CreditAttribution: dehacker commentedWe 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.
Comment #6
mpotter CreditAttribution: mpotter commentedI 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.
Comment #7
mpotter CreditAttribution: mpotter commentedSorry, 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.
Comment #8
b.bosiljcic CreditAttribution: b.bosiljcic commentedI 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.
Comment #9
jmuzz CreditAttribution: jmuzz commentedHere'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.
Comment #10
roborn CreditAttribution: roborn commentedThanks 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.
Comment #11
roborn CreditAttribution: roborn commentedChanged the JS selector for wrapper to make it re-usable with other modules, like https://www.drupal.org/project/media_desk
Comment #12
roborn CreditAttribution: roborn commentedThe .form-wrapper needs to be more specific.
Comment #13
PI_Ron CreditAttribution: PI_Ron commentedCan confirm patch in #12 removes the error nicely.
Comment #14
loze CreditAttribution: loze commentedAlso confirming that patch in #12 works.
Comment #15
brockfanning CreditAttribution: brockfanning commentedDoes #12 depend on another patch? I'm having trouble getting it to apply.
Comment #16
brockfanning CreditAttribution: brockfanning commentedI'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).
Comment #17
ergophobe CreditAttribution: ergophobe commented#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.
Comment #18
Rob C CreditAttribution: Rob C commentedI 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?
Comment #19
loze CreditAttribution: loze commentedplupload and multiform need to be enabled. Then select "media multiselect" for your field widget.
Comment #20
ergophobe CreditAttribution: ergophobe commentedTo 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.
Comment #21
Rob C CreditAttribution: Rob C commentedThe 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 ...
Comment #22
ergophobe CreditAttribution: ergophobe commentedTo provide one signpost...
Media 7.x-2.0-alpha3+37 (dated 2014-05-22) is I believe commit df4cccc4e2fd401fc4ce43085aeb6af264992d30 which reverts the previous commit.
Comment #23
mglaman#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.
Comment #24
mglamanSo, 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.
Comment #25
migueltrindade CreditAttribution: migueltrindade commentedYes!!!!.... #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!
Comment #26
ergophobe CreditAttribution: ergophobe commented#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)
Comment #27
mglamanergophobe, 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.
Comment #28
ergophobe CreditAttribution: ergophobe commentedmglaman - 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.
Comment #29
jmuzz CreditAttribution: jmuzz commentedI 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:
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.
Comment #30
ergophobe CreditAttribution: ergophobe commentedStrangely, this is now giving me javascript errors. When I enable Multiselect I get this
Comment #31
ergophobe CreditAttribution: ergophobe commentedHmm... 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)
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.
Comment #32
kporras07 CreditAttribution: kporras07 commentedAdded patch that works for me. The other ones didn't apply in my env.
Comment #33
mpotter CreditAttribution: mpotter commentedNot sure if this is the same problem as #30 or #31, but I am getting a popup error after it tries downloading each file:
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.
Comment #34
mpotter CreditAttribution: mpotter commentedOh 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!
Comment #35
AndrewTur CreditAttribution: AndrewTur commentedHi 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.
Comment #36
ergophobe CreditAttribution: ergophobe commentedmpotter - 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.
Comment #37
Anonymous (not verified) CreditAttribution: Anonymous commentedWith:
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
Comment #38
legolasboThe 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.Comment #39
Rob C CreditAttribution: Rob C commentedI'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)
Comment #40
mglamanI'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.
Comment #41
legolasbo@mglaman I've got this working with Media 7.x-2.0-alpha4 using patch from #12
Comment #42
mglaman@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.
Comment #43
Jean Gionet CreditAttribution: Jean Gionet commentedMedia 7.x-2.0-alpha4 using patch from #12 also worked for me! thanks
Comment #44
mglamanMarking 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.Comment #45
mglamanLinking 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.
Comment #46
msound CreditAttribution: msound commentedcomment deleted, no relevant to media_multiselect module.
Comment #47
msound CreditAttribution: msound commentedWhen 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
Comment #48
sheldonkreger CreditAttribution: sheldonkreger commented@mglaman Great idea to port this functionality to Media Module itself. I'm a supporter ;-)
Comment #49
rcodina CreditAttribution: rcodina commented@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.
Comment #50
Rob C CreditAttribution: Rob C commentedI 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
Comment #51
msound CreditAttribution: msound commentedWhen 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.
Comment #52
msound CreditAttribution: msound commentedIn continuation to patch #51 here is an improvement where jquery_version is added conditionally (if jquery update module is enabled).
Comment #53
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedThis 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
Comment #54
ergophobe CreditAttribution: ergophobe commentedTo 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.
Comment #55
PI_Ron CreditAttribution: PI_Ron commentedergophobe... Legend.
Comment #56
ergophobe CreditAttribution: ergophobe commentedThank mglaman for that patch. The patch *is* great though - the solution I've been looking for for Drupal ever since version 4.6.
Comment #57
erykmynn CreditAttribution: erykmynn commented#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!
Comment #58
momchil_brashnyanov CreditAttribution: momchil_brashnyanov at Propeople (now part of FFW) commentedThis patch applies the changes from #12 to the 7.x-1.x branch.
Comment #59
joseph.olstadPatch #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
Comment #60
joseph.olstadComment #61
joseph.olstadThe media_multiselect module is deprecated by the newer media 7.x-2.0 beta and higher and the multiform module latest release