Problem/Motivation

Exposed checkbox filter widget is not working when the operator is exposed

Steps to reproduce

1) Create taxonomy term with some terms
2) Add Taxonomy reference to the created taxonomy vocabulary on a content type
3) Goto views and edit the content view
4) Add the taxonomy reference as an exposed dropdown filter and allow multiple selections
5) Change the exposed form style to BEF
6) Open the exposed form options and select the added filter choose widget: checkboxes
At this point everything works as expected
7) Edit the exposed filter and select Expose operator.
No more checkboxes :c

Comments

Victonator created an issue. See original summary.

victonator’s picture

When commenting code in the views module in file core/modules/views/src/Plugin/views/filter/FilterPluginBase.php (Line 957-962) It works as expected.

      if ((!empty($this->options['expose']['use_operator']) && !empty($this->options['expose']['operator_id'])) || count(Element::children($form[$value]))) {
        $wrapper = $value . '_wrapper';
        $this->buildValueWrapper($form, $wrapper);
        $form[$wrapper][$value] = $form[$value];
        unset($form[$value]);
      }
shailja179’s picture

Assigned: Unassigned » shailja179
Status: Active » Needs work
shailja179’s picture

Status: Needs work » Needs review
StatusFileSize
new2.51 KB

This patch will fix the issue for checkboxes. Try it with latest version(6.0.3) of module.

arpitk’s picture

I tested this patch #4 on version 6.0.3. Attaching the screenshots for tags filter before and after applying patch.

Thanks!

victonator’s picture

Patch #4 works, but when a lot of checkboxes are present, a scrollable element is needed (Like before) else the filter will be really long.

victonator’s picture

Nevermind my previous comment #6, Patch #4 works like intended

fluidstack’s picture

I can confirm Patch # 4 works as expected. However, i just logged a new issue very similar to this, but it is using the "Remember the last selection" feature. https://www.drupal.org/project/better_exposed_filters/issues/3359182

  • smustgrave committed d58a17cf on 6.0.x
    Issue #3357961 by shailja179: Checkbox filter widget not working when...
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Confirmed the issue and that the patch solves the issue.

smustgrave’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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