Exposed filter group doesn't work

Created on 7 September 2024, 4 months ago

Problem/Motivation

I need to filter by content with past and future dates with using checkboxes, views support Group filter, so I've added group item with operator "<=" and value "now" and another group item with ">=" and "now". See attached image.
But date_filter doesn't support exposed fitler groups, like it's done in standard views date filter.

Steps to reproduce

Add exposed filter, select "grouped filter" and add a few options.

Proposed resolution

Add special case $this->isAGroup() to code and take the provided values instead of using input data.

Remaining tasks

Need proper testing, patch covers my use-case, but not sure about others.

User interface changes

No.

API changes

No.

Data model changes

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine zviryatko

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

Comments & Activities

  • Issue created by @zviryatko
  • πŸ‡ΊπŸ‡ΈUnited States ceithamer728

    I was having the same problem, none of the grouped filters would work. You can add them in the view admin but they all resulted in an error when trying to actually filter by them in the form.

    zviryatko's patch didn't work for me. Not sure if he's on a different version but the code looked different.

    I'm on version 1.0.1.

    Attached a patch that resolved the issue for me on our version. I did similar thing as zviryatko and just added this check at the top of DateBase::acceptExposedInput()

        if ($this->isAGroup()) {
          return parent::acceptExposedInput($input);
        }
    
  • πŸ‡ΊπŸ‡¦Ukraine zviryatko

    thanks @ceithamer728, actually I've tried to include the case to use default parent method when grouping is enabled, but it looks like not all cases. Can you give more context what grouping filters you have, or upload screenshot of views filter configuration, will try to add some tests that covers both.

Production build 0.71.5 2024