Problem/Motivation

Grouped filters with a value of zero do not show when editing the filter. This is probably because '0' is an "empty" value according to PHP.

Steps to reproduce

  1. Create a view with a grouped filter (e.g. on user ID).
  2. Have one of the groupings use "Is equal to" or "Is not equal to", and a value of "0".
  3. Save the view.
  4. Then, edit the grouped filter, and where you entered "0", the HTML input is now empty, and the UI complains that you have not entered a required value.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

solideogloria created an issue. See original summary.

solideogloria’s picture

Issue summary: View changes
lendude’s picture

Status: Active » Closed (duplicate)
Issue tags: +Bug Smash Initiative

Thanks for reporting this.

I'm marking this as a duplicate of #1869728: Hybrid or grouped exposed filters UI - zero values can be saved but not retrieved, please feel free to re-open this if you feel this is addressing a different issue.

solideogloria’s picture

Status: Closed (duplicate) » Active

That's an issue for Views (Drupal 7), which is a contrib module. This is also an issue in Core for Drupal 8+, so it needs to be fixed here, too.

lendude’s picture

Status: Active » Needs review
Related issues: +#2992261: Views exposed grouped filter for number field doesn't work
StatusFileSize
new796 bytes

Right you are, thanks for reopening!

#2992261: Views exposed grouped filter for number field doesn't work was probably a duplicate but that got closed but not reopened, so lets keep this one open.

Easy enough to reproduce.

Patch seems to fix it, needs tests.

solideogloria’s picture

Issue tags: +Needs tests
solideogloria’s picture

I confirmed that the patch fixed the issue.

smustgrave’s picture

Status: Needs review » Needs work

For the tests.

lendude’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new1.49 KB
new2.26 KB

And a test, interdiff is the test only patch.

The last submitted patch, 10: 3370222-10-TEST_ONLY.patch, failed testing. View results

solideogloria’s picture

Status: Needs review » Reviewed & tested by the community

This looks good to me. The fact that you can see the test-only fail but the patch with test succeed makes it pretty clear it works.

  • larowlan committed 52b0cd54 on 10.1.x
    Issue #3370222 by Lendude, solideogloria: Grouped filters with a value...

  • larowlan committed 08bde872 on 11.x
    Issue #3370222 by Lendude, solideogloria: Grouped filters with a value...
larowlan’s picture

Version: 11.x-dev » 10.1.x-dev
Status: Reviewed & tested by the community » Fixed

Committed 08bde87 and pushed to 11.x. Thanks!

Backported to 10.1.x

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.