I recently upgraded this module and previously had the patch from #1298838: Ease alteration of the Files administration page's query to allow me to alter the form and query objects on the file admin page to add my own filters. One of the filters I had was "File usage" where there were 2 options: In use, or Not in use. This meant admins could easily see an overview of all files that weren't in use on the site and delete them (for example). With the upgrade of the module this approach was no longer possible so I went and implemented something similar as a views plugin. Not sure if this is the right place for this but thought it'd be best to get it up and then get feedback instead of deciding myself. I'm also fairly new to views query api so guide me if I've done something blindingly dumb!
Patch to follow
Comment | File | Size | Author |
---|---|---|---|
#8 | 2052461-file-usage-filter-boolean-8.patch | 2.55 KB | aaron |
#6 | 2052461-file-usage-filter-boolean.patch | 2.55 KB | jvandyk |
#6 | 2052461_exposed_filters.png | 18.44 KB | jvandyk |
#1 | 2052461-file-usage-filter.patch | 2.49 KB | acbramley |
Comments
Comment #1
acbramley CreditAttribution: acbramley commentedComment #2
mirzu CreditAttribution: mirzu commentedWorks and the patch looks good.
Comment #3
mirzu CreditAttribution: mirzu commentedwhoops wrong issue! too many tabs.
Comment #4
mirzu CreditAttribution: mirzu commentedOK Tested now. Works as expected. I also don't have tons of experience with writing plugins so I'm hesitant to mark it RTBC without another review. Another fine gentleman at the code sprint is reviewing it.
Comment #5
jvandyk CreditAttribution: jvandyk commentedSince there are only ever two options, the filter should ask File in use? Yes / No rather than having two checkboxes. Rather than extend views_handler_filter_in_operator could views_handler_field_boolean be extended? I am investigating.
Comment #6
jvandyk CreditAttribution: jvandyk commentedPatch updated to provide boolean choices. Like other boolean filters, it can also provide the -- Any -- choice in an exposed filter if "Required" is unchecked. So you can have an exposed filter to choose between -- Any --, used, and unused:
Comment #7
acbramley CreditAttribution: acbramley commentedYeah boolean makes more sense here but the reasons you changed it don't make sense to me since I have the exact same widget using my patch. It provides the -Any- key when the filter is not required and it provides it as a select list.
I do now see however that there was a bug when selecting required using my patch. Thanks for the update.
Comment #8
aaron CreditAttribution: aaron commentedChasing HEAD...
Comment #9
acbramley CreditAttribution: acbramley commentedComment #10
aaron CreditAttribution: aaron commented8: 2052461-file-usage-filter-boolean-8.patch queued for re-testing.