Problem/Motivation
Since a value of true does not meet the condition if (empty($this->value)) { below, the option to accept null is not does not apply in web/core/modules/views/src/Plugin/views/filter/BooleanOperator.php.
if (empty($this->value)) {
if ($this->accept_null) {
if ($query_operator === self::EQUAL) {
$condition = (new Condition('OR'))
->condition($field, 0, $query_operator)
->isNull($field);
}
else {
$condition = (new Condition('AND'))
->condition($field, 0, $query_operator)
->isNotNull($field);
}
$this->query->addWhere($this->options['group'], $condition);
}
else {
$this->query->addWhere($this->options['group'], $field, 0, $query_operator);
}
}
This is possible to get around by simply setting 'Is equal to' 'False' instead of 'Is not equal to' 'True' of course, so this is a minor issue.
Proposed resolution
Allow 'Accept null' to be used when 'Is not equal to' is selected as well.
Remaining tasks
Provide patch and tests.
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
Views Boolean filter now allows accept null on 'Is not equal to' value of 'True'.
Comments
Comment #9
quietone commentedAfter reading this I think this is a duplicate of the related issue.
If this is different than that issue, then re-open this issue by setting the status to 'active' adding a comment to explain the difference.