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.
It makes sense that some fields may not way to use all available media browser plugins when using the media widget. We may want to restrict it to existing files, or when I can file the browser views patch, select specific file views to be used.
Comments
Comment #1
Dave ReidComment #2
Dave ReidForgot media_internet's plugin.
Comment #3
Dave ReidScreenshots:
Comment #4
webflo CreditAttribution: webflo commented+1, i going to review this patch in a few days.
Comment #5
mstrelan CreditAttribution: mstrelan commentedsubscribe
Comment #6
Dave ReidWow, actually found a pretty big bug with this patch when using multiple media browser widgets on the same page. Now I finally understand some of the JS.
Comment #7
aaron CreditAttribution: aaron commentedGood start; the field settings page works as advertised. However, it breaks the library tab (at least if you have only that selected); no existing media will then display.
Comment #8
aaron CreditAttribution: aaron commentednote the library tab still works in other places.
Comment #9
Dave ReidHrm, I'm inclined to say this is a bug in the library JS then - since only using the 'Upload' plugin on a field works just fine, so it's not necessarily related to only selecting one enabled plugin.
Comment #10
andypost+1 Great!
I'm using hook_media_browser_plugins_alter() to unset plugins but making this as field settings makes a lot of sense
Comment #11
idflood CreditAttribution: idflood commentedgreat idea.The patch looks good and is working well. I have copied the patch line by line because it wouldn't apply. The library javascript is fixed by changing the listened event. It listens to "show" instead of "select" now, hope it doesn't break something (shouldn't).
Comment #12
idflood CreditAttribution: idflood commentedComment #13
garbo CreditAttribution: garbo commentedWow! that looks good indeed!
Comment #14
barraponto CreditAttribution: barraponto commentedIt worked fine for me. I don't know whether it needs an update path, since I patched media before installing it. I recommend someone tries this out before RTBC.
Comment #15
Dave Reid.
Comment #16
robeano CreditAttribution: robeano commentedThe latest patch does not apply cleanly to 7.x-2.x branch. I'll re-roll it and let's try testing it again. There is no need for an upgrade path for this particular change.
Comment #17
robeano CreditAttribution: robeano commentedPlease test this new patch which works with the latest 7.x-2.x
Comment #18
idflood CreditAttribution: idflood commentedthe patch looks, good. i will test it in 5 minutes.
edit: tested the patch, works as advised. (tested without restricting "module", then only library, then only upload. finally enabled media_youtube and internet source, also working)
Comment #19
Dave ReidLet's DO IT!
Comment #20
andypostSuppose a part of this patch "the listened event" should be backported to 7.x-1.x
Comment #21
robeano CreditAttribution: robeano commentedCommitted: d734cd2.
It is not clear to me that backporting part of this patch is necessary.
Comment #22
Dave ReidI'd support backporting the one-line JS fix. Robin just go ahead and commit it without a patch. Then reset this issue back to 7.x-2.x.
Comment #23
robeano CreditAttribution: robeano commentedLuckily @davereid knew better. I've committed the JS cleanup directly to the 7.x-1.x branch: ccecbd5.
Thanks @andypost and @davereid and #D7MediaSprint...it was easy to figure out with @davereid in the same room!
Comment #25
dealancer CreditAttribution: dealancer commentedWas this patch commited to a 7.x-1.x? I could not find the way how to disable some upload methods. Please advice.
Comment #26
Dave ReidNo. 7.x-1.x is not getting any new features backported, only bug fixes.