Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
When you expose a field of type boolean is always checked.
case 'bef_single':
$show_apply = TRUE;
// Use filter label as checkbox label.
$form[$field_id]['#title'] = $filters[$label]->options['expose']['label'];
$form[$field_id]['#return_value'] = 1;
$form[$field_id]['#type'] = 'checkbox';
break;
To reproduce yon can add new field boolean to content type article par exemple, and create new view with this field exposed as checkbox.
See older issue https://www.drupal.org/project/better_exposed_filters/issues/2618500
Proposed resolution
We need to assign correct value after submit.
Comment | File | Size | Author |
---|---|---|---|
#5 | 2947281_1.patch | 2.25 KB | focus13 |
Comments
Comment #2
focus13 CreditAttribution: focus13 as a volunteer and for Klee Interactive (Klee Group) commentedComment #3
focus13 CreditAttribution: focus13 as a volunteer and for Klee Interactive (Klee Group) commentedComment #4
nkoporecHello @focus.I tested your patch and On/Off bug is fixed but you have one warning in a patch(warning: 1 line adds whitespace errors.
at line 39), so please fix it.
Comment #5
focus13 CreditAttribution: focus13 as a volunteer and for Klee Interactive (Klee Group) commentedComment #6
focus13 CreditAttribution: focus13 as a volunteer and for Klee Interactive (Klee Group) commented@nkoporec i have fixed the warning. Thanks
Comment #7
nkoporecTested the latest patch from @focus13 and the patch error is gone.
Comment #8
rondog469 CreditAttribution: rondog469 commentedJust came across this today. Hopefully this gets committed soon!
Comment #9
nkoporecComment #10
Anys CreditAttribution: Anys commented#5 working great, thanks
Comment #12
rlhawkCommitted, thanks.