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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

acbramley’s picture

Status: Needs work » Needs review
FileSize
2.49 KB
mirzu’s picture

Status: Needs review » Reviewed & tested by the community

Works and the patch looks good.

mirzu’s picture

Status: Reviewed & tested by the community » Needs review

whoops wrong issue! too many tabs.

mirzu’s picture

OK 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.

jvandyk’s picture

Since 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.

jvandyk’s picture

Patch 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:

acbramley’s picture

Yeah 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.

aaron’s picture

Chasing HEAD...

acbramley’s picture

Assigned: acbramley » Unassigned
Issue summary: View changes
aaron’s picture