Problem/Motivation
Core Views module allows users to reduce a list of exposed taxonomy terms in taxonomy term filter to a specified list from the exposed filter options form. This functionality seems to be present for SearchApiViewsHandlerFilterOptions filter in Search API, but SearchApiViewsHandlerFilterTaxonomyTerm does not extend the SearchApiViewsHandlerFilterOptions filter, so it misses that functionality.
Proposed resolution
Implement support for 'reduce' exposed option for SearchApiViewsHandlerFilterTaxonomyTerm handler.
Remaining tasks
Provide patch for D8
Provide backport for D7
User interface changes
Adds new "Limit list to selected items" checkbox to the taxomony term exposed filter options form that allows users to reduce the exposed form options to a specified list of terms.
API changes
None
Data model changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | 2665970-12--views_term_filter_reduce_option.patch | 2.93 KB | drunken monkey |
Comments
Comment #2
the.tai.pen@gmail.com commentedAdding patch for implementing feature in D7.
Comment #5
the.tai.pen@gmail.com commentedTest against 7.x version.
Comment #6
asgorobets commentedI guess 'contains' key will not affect any default settings. Looks like $options['expose']['reduce'] = array('default' => FALSE) might be what you're looking for.
I've checked SearchApiViewsHandlerFilterOptions and it also checks for 'contains' key.
Can you check how default value is affected?
Comment #7
the.tai.pen@gmail.com commentedComment #8
the.tai.pen@gmail.com commentedComment #9
the.tai.pen@gmail.com commentedComment #10
the.tai.pen@gmail.com commentedComment #11
the.tai.pen@gmail.com commentedThank you for noticing. 'contains' key was not needed there. Default values are not affected. I've updated the patch.
Comment #12
asgorobets commentedLooks great, may need a D8 patch as well.
Comment #13
drunken monkeyThanks for opening this issue and already providing a patch! This seems indeed like useful functionality, and the patch also looks quite good already.
I don't know where you got that idea from, but when you look at any of the handler in the Views module itself, you'll see that the version with
'contains'is actually the correct one – even though, as I see now, we have that wrong in the parent handler as well.The attached revised version works fine for me. Please test/review!
Comment #14
drunken monkeyComment #15
the.tai.pen@gmail.com commentedThank you for your comments and advice!
I've tested the patch - works as expected. I was unable to find any issues.
Comment #16
the.tai.pen@gmail.com commentedComment #18
drunken monkeyGood to hear, thanks for testing!
Committed.
Comment #20
the.tai.pen@gmail.com commentedOpened followup bug for this issue here: #2731103: Fix the default value for the taxonomy term filter "multiple" setting