Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293450

Grouped exposed taxonomy term filters do not work

$
0
0

Problem/Motivation

As mentioned in the issue title, if the exposed filter is based on taxonomy reference field and is a type of "Grouped filter", then it's not working properly. To be more exact, it produces incorrect query conditions because it adds the group delta (e.g. 1, 2, 3) instead of term ids to the query. You can find more details in the issue summary of the duplicated issue: #2049603: Exposed Group Filter assigns incorrect tid to SQL Query.

Steps to reproduce

1. Create a content type with a taxonomy reference field;
2. Create a view with content items;
3. Make a filter by taxonomy field with the following settings:
- exposed;
- grouped;
- optional;
- group option with selected terms;
4. Submit the exposed form with the selected group -> observe incorrect results;

Proposed resolution

Looking at the list of duplicated issues, they were trying to solve this problem in different ways.
1. #2049603: Exposed Group Filter assigns incorrect tid to SQL Query is making changes to \Drupal\views\ManyToOneHelper.php and tries to get either value or group info based on filter option (grouped or not). I think it's not quite correct, because the child filter plugin should be responsible for assigning correct value and ManyToOneHelper should just use it and don't try to guess;
2. #2662978: TaxonomyIndexTid::acceptExposedInput() resets the plugin value incorrectly. is trying to fix \Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTid, but it's removing some changes that affects default filter behavior. I think we should find another way. We'll try to bring a test from that issue;

Remaining tasks

1. Close duplicated issues;
2. Retrieve a test coverage from #2662978: TaxonomyIndexTid::acceptExposedInput() resets the plugin value incorrectly.;
3. Make it ready for review;
4. Ping @lendude to take a look :)

Original report by @drupalninja

I am trying to group counple of exposed filters in a View In the content type called Product, I have a taxonomy vocab 'Product Type' with terms 'Charts', 'Labels','stickers', Friezes'. Now when I add a filter of 'Product Type' Content and expose it with grouped Values say
Stickers Is one of Labels
Stickers
Charts is one of Charts
Friezes

I get these option on the view but when I select one of them none the valus gets returned.
But if I select 'any' in the same filter all the values are retured. I have tries Views 7.x 3.5 dev version


Viewing all articles
Browse latest Browse all 293450

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>