When you change the filters in the media dialog, it seems to override the "Enabled browser plugins" configured in the field settings, causing disabled tabs to appear.

For example, field_oa_banner has Upload, Library, and My Files checked in the configuration and those are the tabs that initially show up in the media browser. But, when you hit Apply on the filters, the Web tab suddenly shows up and becomes the active tab. The same thing happens in the WYSIWYG, except in that case it's My Files that is initially disabled and then suddenly appears.

If you look at the path for the iframe, you can see that initially it's something like: /media/browser?render=media-popup&types%5B%5D=image&types%5B%5D=video&types%5B%5D=audio&types%5B%5D=document&enabledPlugins%5B%5D=upload&enabledPlugins%5B%5D=media_default--media_browser_1&enabledPlugins%5B%5D=media_internet&file_directory=&id=media_wysiwyg&plugins=undefined

But after clicking apply the path looks like: /media/browser?filename=&type=All&oa_section_ref_target_id=All&og_group_ref_target_id=0&sort_by=timestamp&sort_order=DESC&render=media-popup

Basically, the enabledPlugins and other parameters get lost.

I believe the root of the problem is that something is preventing the views exposed filter form from using AJAX, though I can't figure out what might be causing that.

I've tested with a basic Drupal 7 instance with just the Media module enabled as well as a stock Panopoly install, and in both cases the filters used AJAX and worked as expected.

Comments

JeffM2001 created an issue. See original summary.

mpotter’s picture

Yep, I can reproduce this in my Atrium dev. Not sure what would be causing this. Wonder if it's something specific to the oa_banner field since when I do this on the Attachment field of a content type (like an Event), clicking Apply doesn't change the tab focus.

JeffM2001’s picture

I think the difference with the Attachment field is that it's already set to allow all the tabs, so when the enabledPlugins parameter gets lost it doesn't actually change anything. Even in that case though, it's doing a full form submit instead of using AJAX like it should, right?

mpotter’s picture

I wonder if the view being used by Media Browser just doesn't have the Ajax option enabled?

JeffM2001’s picture

It's set to use AJAX in the view settings — and in Panopoly it does use AJAX. Can't figure out what's happening in OA that turns off or breaks the AJAX for the form.

JeffM2001’s picture

Stumbled into some more info on this. In #2477347: Patches for views from OpenAtrium A---- mentioned that this patch breaks AJAX views: https://www.drupal.org/files/issues/1735096-views-multiple-instance-expo...

Tested it out, and reversing that patch does indeed fix this issue. Not totally sure where that leaves us, but figured I'd share what I learned.

mpotter’s picture

Hmm, the problem is that patch is needed to fix other problems in views. So somehow we need a patch that solves the problem of getting unique ids into views so you can have more than one on the same page, while also not breaking the Ajax.

An example of what the patch fixes is when you have multiple blocks on a page that use the same view and filters. You need unique IDs for the filters. However, the Ajax is probably tied to a specific ID (probably the first filter of the type added to the page). So that could explain why Ajax is enabling and focusing the My Files is if it's filter has the original ID that Ajax is targeting.