Problem/Motivation

When browsing files with Media Browser Plus, there is no easy way for a user to determine which scheme a given file is assigned.

Media Browser Plus offers enhanced forms where files can be browsed by directory. A directory is created for each local file scheme. Typically, this may include 'public' and 'private'. When a user clicks on a directory, the combined contents of all local file schemes are displayed.

It can be important to know whether one is placing a public vs. a private file. The default file browsing interface provided by File Entity includes a 'scheme' filter, but there is not one for MBP.

Proposed resolution

Add a "Scheme" filter to the media_browser_plus view.

  • First, add a 'uri' exposed filter. By default, this filter provides a text field for input.
  • In hook_form_FORM_ID_alter(), alter the 'uri' filter to provide a select element drawing values from available file schemes. This code is adapted from file_filters() in File Entity.

Remaining tasks

Needs review.

User interface changes

The three displays of the media_browser_plus now include a "Scheme" filter similar to the existing "Type" one.

API changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nedjo’s picture

Status: Active » Needs review
FileSize
4.03 KB
nedjo’s picture

Fix typo in code comment.

das-peter’s picture

That would really be an useful addition :)
I'm not very keen of the usage of media_browser_plus_form_views_exposed_form_alter() because this means it will also "affect" frontend code. But atm. this seems to be the best way to deal with it.
Further I'd like to avoid showing a useless filter which means if there's simple one stream wrapper we should hide the filter.
I tried to achieve that in the form alter too - I think that's better and more flexible than adjusting the exported views code based on available stream wrappers.
Updated patches attached.

nedjo’s picture

I'd like to avoid showing a useless filter

Nice refinement!

  • Commit 44e3da8 on 7.x-3.x authored by nedjo, committed by das-peter:
    Issue #2266685 by nedjo, das-peter: Add filter by file scheme to MBP...
das-peter’s picture

Status: Needs review » Fixed

I've made another slight adjustment and committed it.
Thanks :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.