I've been working on #228510: Exposed Sorts to try to create a way for the user to select the sort order for things like a list of teasers or comments. Per that work and our conversation in IRC, part of the problem doing this is that there are places in the Views code that make assumptions that only filters will have exposed forms, plus there is a lot of code in the filter handler that would have to be duplicated in any handler that wants to do this.
After creating a sort with an exposed form manually, I figured out where the snags are and which parts of the code will end up being duplicated, so I moved the duplicated code up into handler.inc so it can be shared by any handler and made the rest of the views code more agnostic about what handler is providing a form.
Use cases for allowing other handlers to expose their option forms, besides allowing users to select a sort order, would be things like letting an date argument expose a form where you could select the granularity of the argument or a field handler exposing the choice of what format to use for displaying the field.
Attached is the patch to make exposed filters possible for any handler. This patch is not trying to implement that anywhere, just make it possible.
The thing to test is that filters continue to work correctly and that other handlers don't suddenly acquire forms that are not expected. I've done my own testing and I think it's working right.
| Comment | File | Size | Author |
|---|---|---|---|
| handler.patch | 13.57 KB | karens |
Comments
Comment #1
dixon_Nice one!... subscribing
Comment #2
merlinofchaos commentedI've committed this to the 3.x branch; while this needs further testing, I think this is probably the best way to accomplish that.