Views exposed group filter (with option allow multiple selections) generates notices when using date and date range fields

Created on 21 October 2020, about 4 years ago
Updated 1 May 2023, over 1 year ago

Problem/Motivation

There is an issue with views exposed group filter for date and date range fields. When I create a grouped filter for a date range field with the option to "Allow multiple selections" (which will turn the radio buttons into checkboxes) a warning is being thrown.

Notice: Undefined index: type in Drupal\views\Plugin\views\filter\Date->acceptExposedInput() (line 128 of /var/www/example-site/docroot/core/modules/views/src/Plugin/views/filter/Date.php)

After some investigation, I noticed that Drupal\views\Plugin\views\filter\Date->acceptExposedInput() is called at the beginning when the input is not transformed yet (which happens in \Drupal\views\Plugin\views\filter\FilterPluginBase::convertExposedInput()).

When the input is transformed, then for each group Drupal\views\Plugin\views\filter\Date->acceptExposedInput() is called, and it's working fine.

Steps to reproduce

1) Configure an exposed grouped filter by any date or date range field;
2) Select "Allow multiple selections";
3) Try filtering the results;

Proposed resolution

Skip the processing in \Drupal\views\Plugin\views\filter\FilterPluginBase::convertExposedInput(), when group info is not available yet.

Remaining tasks

Combine tests from https://www.drupal.org/project/drupal/issues/2825860#comment-14911701 πŸ› Notice: Undefined index: value in Drupal\views\Plugin\views\filter\NumericFilter->acceptExposedInput() Needs work

πŸ› Bug report
Status

Needs work

Version

10.0 ✨

Component
ViewsΒ  β†’

Last updated about 6 hours ago

Created by

πŸ‡§πŸ‡ͺBelgium bernardopaulino Brussels

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024