- πΊπΈUnited States AaronBauman Philadelphia
patch #21 does not solve the problem for me
I'm trying to create a Views filter plugin which shows a checkbox, and seeing some odd behaviour:
1.
My own custom code works with submitting the form: I correctly get 'key=1' in the URL query when I submit with the checkbox selected. What doesn't work is the default value of the filter: when this is set to enabled by default, the first load of the view does not have the checkbox selected. I can't figure out why -- hook_form_alter shows me the checkbox form element has a #default_value => 1 as expected, but the produced HTML form element is missing the checked="checked" attribute.
2.
In an attempt to figure out if this was a core bug, I temporarily hacked the BooleanOperator filter plugin to make it show a checkbox:
if ($exposed = $form_state->get('exposed')) {
// Exposed filter: use a select box to save space.
$filter_form_type = 'checkbox';
}
I made a test view with the node status field exposed.
This *does* correctly show the default value for the filter. But when I submit the exposed form, no matter whether the checkbox is selected or not, it always reloads with the checkbox selected. The URL query looks right though. In other words:
- select and submit: result URL ?status=1, checkbox selected
- unselect and submit: result URL has no query string, checkbox selected!
Needs work
11.0 π₯
Last updated
The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
patch #21 does not solve the problem for me