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

scott_euser created an issue. See original summary.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.9 was released on November 6 and is the final full bugfix release for the Drupal 8.7.x series. Drupal 8.7.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.8.0 on December 4, 2019. (Drupal 8.8.0-beta1 is available for testing.)

Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Active » Closed (duplicate)
Issue tags: +Bug Smash Initiative

After 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.