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

Grouped exposed taxonomy filter fails validation for autocomplete widget

$
0
0

Problem/Motivation

When creating exposed grouped filters in a view, if a group is named and using autocomplete widget to add group items (can be taxonomy terms or users), the form throws the error on save:

The value is required if label for this item is defined.

Here is the screenshot of the error:
image 1

The problem behind this is that array of arrays is not recognized here:

$min_values = $operators[$group['operator']]['values'];
$actual_values = count(array_filter($group['value'], 'static::arrayFilterZero'));

In case autocomplete, it has the following data format:

[
  0 => [
    ' target_id' => 1
  ] ,
]

but the code above expects it to be:

[
  1 => 1
]

so it doesn't pass the filtering in static::arrayFilterZero

Affected plugins:

  1. \Drupal\user\Plugin\views\filter\Name (#2920039: Views' User Name exposed group filter validation)
  2. \Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTid (this issue)

Steps to reproduce

  1. Install Drupal with "Standard" profile
  2. Open content view (/admin/structure/views/view/content)
  3. Add an exposed grouped filter by "Tags" (Taxonomy). Make sure the group item is using autocomplete widget
  4. Add at least one item to the group configuration
  5. Submit

Proposed resolution

Convert values into array with ids, which is expected by base filter plugin.

Remaining tasks

1) Wait for #1810148: Grouped exposed taxonomy term filters do not work;
2) Review/commit;


Viewing all articles
Browse latest Browse all 295586

Trending Articles



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