Problem/Motivation
A default value of TRUE on a boolean filter results in no filter being applied. This is because \Drupal\views\Plugin\views\filter\FilterPluginBase::acceptExposedInput received $input = TRUE and then performs:
if ($value == 'All' || $value === array()) {
return FALSE;
}
The non-strict comparison results in it incorrectly thinking it's in 'all' mode.
Proposed resolution
Switch to a strict comparison.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 2734197-11-8.3.x.patch | 615 bytes | yanniboi |
| #11 | 2734197-11.patch | 615 bytes | yanniboi |
| #8 | 2734197-8.patch | 625 bytes | yanniboi |
| #2 | 2734197-2.patch | 634 bytes | andrewbelcher |
Comments
Comment #2
andrewbelcher commentedHere's a patch that fixes the issue. I don't have time for tests now, but if no one else gets to it I will try and do that.
Comment #3
andrewbelcher commentedComment #4
lendudeThis is a symptom of #2459289: Boolean default values are not saved, when that is fixed, this should work too.
Comment #5
andrewbelcher commentedI'm not 100% sure it is - while trying to fix I manually updated the yml and imported and was still having issues, which this resolved.
I suggest we postpone it until that one is resolved at which point we can confirm one way or the other.
Comment #6
lendude@andrewbelcher my bad, you are right, from what you describe this is unrelated. Was getting caught up in too many config related changes.
But I tried to reproduce this with an exposed non-grouped published filter on the content View and that was working fine with a default of 'Yes'.
Do you have steps to reproduce?
Comment #8
yanniboi commentedreroll
Comment #11
yanniboi commentedreroll
Comment #20
quietone commented@andrewbelcher, Thank you for reporting this problem. We rely on issue reports like this one to resolve bugs and improve Drupal core.
There has been no activity here for 5 years.
More information about this issue was asked for in #6, 6 years. No additional information has been supplied, therefor closing.
If you are experiencing this problem on a supported version of Drupal reopen the issue, by setting the status to 'Active', and provide complete steps to reproduce the issue (starting from "Install Drupal core").
Thanks!