Steps to reproduce

Use the same steps to reproduce as in #3294700: Date filter shows error in view exposed group filter with multiple select option, but make the field required (not optional), and select one of the grouped options as default value.

You'll get the warning:

The submitted value in the my-filter-name element is not allowed.

Proposed resolution

This is caused in FilterPluginBase, which expects $this->group_info to always contain the default value. When the filter is build on a date (range) field (and probably on some other field types too), the group_info can contain an array of information instead of only the default value.

buildExposedFiltersGroupForm() uses $this->options['group_info']['default_group'] as default value. This should also be the case in groupForm(). The same logic for default_group_multiple

Issue fork drupal-3523482

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

matthiasm11 created an issue. See original summary.

matthiasm11’s picture

Status: Active » Needs review
StatusFileSize
new1.57 KB

Attached a static patch of the MR.

lendude’s picture

Status: Needs review » Needs work

This will need some test coverage and looking into the test failure.

apmsooner’s picture

StatusFileSize
new136.18 KB

I've run into this issue as well but the patch as is didn't fix it. The issue i'm seeing is that when a value is set in the exposed filter for filter type single and then the filter type changes to grouped, the value structure is different and the select widget for grouped filter can't find the current value. I'm attaching a screenshot of what is working for me locally by adding the highlighted part.

Code

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.