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 fromfile_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.
Comment | File | Size | Author |
---|---|---|---|
#3 | mbp-file-scheme-filter-2266685-3-D7.patch | 4.24 KB | das-peter |
#3 | interdiff-2266685-2-3-do-not-test.diff | 1.16 KB | das-peter |
#2 | mbp-file-scheme-filter-2266685-2-D7.patch | 4.03 KB | nedjo |
Comments
Comment #1
nedjoComment #2
nedjoFix typo in code comment.
Comment #3
das-peter CreditAttribution: das-peter commentedThat 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.
Comment #4
nedjoNice refinement!
Comment #6
das-peter CreditAttribution: das-peter commentedI've made another slight adjustment and committed it.
Thanks :)