Problem/Motivation
Date views filter (\Drupal\views\Plugin\views\filter\Date) throw a php warning with checked "Allow multiple selections" option.
Warning: Undefined array key "type" in Drupal\views\Plugin\views\filter\Date->acceptExposedInput() (line 128 of core/modules/views/src/Plugin/views/filter/Date.php).
This happens because when the "Allow multiple selections" option is checked the $this->group_info
is array.
And this condition in the \Drupal\views\Plugin\views\filter\Date::acceptExposedInput
is not enought because $this->group_info['type']
can be an empty and cause a warning:
if (is_array($this->group_info)) {
$type = $this->group_info['type'];
}
Steps to reproduce
- Install Drupal standard profile
- Edit the default Content view at /admin/structure/views/view/content
- Add a "Created" filter
- Select "Expose this filter to visitors, to allow them to change it"
- Select "Grouped filters"
- Set the Grouping 1 label to "Last week", operator to "Is greater than", value type to "An offset from ..." and value "-7 days"
- Check "Allow multiple selections"
- Press Apply and then Save
- Navigate to /admin/content
Proposed resolution
Replace condition in the \Drupal\views\Plugin\views\filter\Date:127
if (is_array($this->group_info)) {
withif (!empty($this->group_info['type'])) {