After the commit 2328c3c7 for issue #1261844: views_handler_filter_in_operator does not work with optgroups. (thanks a lot to git bisect !), exposed filters having some explicit value options and have the "Limit list to selected items" option checked generates broken options lists, where all the actual values are replaced by 1.

I'm attaching the export of a rather simple Views that demonstrate the problem.

The problem is the the form_options_flatten introduced to fix #1261844: views_handler_filter_in_operator does not work with optgroups. clobbers the actual values in $this->value_options, and replaces them by 1 whenever it's a simple key. As long as the values aren't used afterwards, that's ok-ish, but if the exposed filter is configured to Limit list to selected items, then those options are re-used for creating the actual widgets, leading to the broken display.

I'm working on a patch to fix that.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DeFr’s picture

Attaching promised patch. This makes the use of form_options_flatten more in line with what's done in node_filter_form_submit, creating a temporary array that's just checked for isset and not clobbering the actual values.

DeFr’s picture

Status: Active » Needs review

Forgot to switch the status to needs review, sorry for the noise.

asplamagnifique’s picture

Status: Needs review » Reviewed & tested by the community

with my version of views 6.x-3.x-dev, values of exposed filters passe at 1 after one action on my views
patch applied, which corrects the problem filters

dawehner’s picture

Status: Reviewed & tested by the community » Fixed

This kind of patch got already commited some time ago. Thanks for providing a patch.

DeFr’s picture

No problem, in fact, looking at the commit (fe453f13) , I can see that it's this patch that went in and the issue simply wasn't updated. That works for me :-)

dawehner’s picture

Oh this happens much too often at the last time.

Status: Fixed » Closed (fixed)

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