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

Comments

andrei.colesnic created an issue. See original summary.

the.tai.pen@gmail.com’s picture

Component: Framework » Views integration
Status: Active » Needs review
StatusFileSize
new1.41 KB

Adding patch for implementing feature in D7.

Status: Needs review » Needs work

The last submitted patch, 2: search_api-limit_checkbox_taxonomy_filter-2665970-2-7.patch, failed testing.

The last submitted patch, 2: search_api-limit_checkbox_taxonomy_filter-2665970-2-7.patch, failed testing.

the.tai.pen@gmail.com’s picture

Version: 8.x-1.x-dev » 7.x-1.x-dev
Status: Needs work » Needs review

Test against 7.x version.

asgorobets’s picture

Status: Needs review » Needs work
+++ b/contrib/search_api_views/includes/handler_filter_taxonomy_term.inc	(revision )
@@ -27,6 +27,7 @@
+    $options['expose']['contains']['reduce'] = array('default' => FALSE);

I 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?

the.tai.pen@gmail.com’s picture

StatusFileSize
new1.06 KB
the.tai.pen@gmail.com’s picture

Status: Needs work » Needs review
the.tai.pen@gmail.com’s picture

Status: Needs review » Needs work
the.tai.pen@gmail.com’s picture

Status: Needs work » Needs review
StatusFileSize
new1.39 KB
the.tai.pen@gmail.com’s picture

Thank you for noticing. 'contains' key was not needed there. Default values are not affected. I've updated the patch.

asgorobets’s picture

Status: Needs review » Reviewed & tested by the community

Looks great, may need a D8 patch as well.

drunken monkey’s picture

Thanks for opening this issue and already providing a patch! This seems indeed like useful functionality, and the patch also looks quite good already.

I 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 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!

drunken monkey’s picture

Status: Reviewed & tested by the community » Needs review
the.tai.pen@gmail.com’s picture

Thank you for your comments and advice!

I've tested the patch - works as expected. I was unable to find any issues.

the.tai.pen@gmail.com’s picture

Status: Needs review » Reviewed & tested by the community

drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Good to hear, thanks for testing!
Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

the.tai.pen@gmail.com’s picture