- 🇬🇧United Kingdom lind101
* Other option, create a View with an optional relationship to something that has a boolean field. In the rows that don't have the relationship the values will be NULL
As Lendude mentions here this is a massive gap in the current boolean filter logic, take the following scenario:
I have a View that lists multiple bundles of the same entity type, one of those bundles has a boolean field. I want to be able to filter the view to only show records that don't have that field (all but one of the bundles), or have a false value for the field. This is currently unachievable.
To my mind this is the main use case we are solving here.
- 🇬🇧United Kingdom lind101
+1 for the patch in #9.
Managed to successfully use the patch to acheive the above use case. I used an OR filter group containing a = FALSE condition and a IS NULL condition. Worked perfectly, thanks!
- 🇺🇸United States tylired
+1 for the patch in +9.
It worked perfectly to provide new operator options "Is empty (NULL)" and "Is not empty (NOT NULL)" inside of the Views Filter Criteria section.
- last update
6 months ago Patch Failed to Apply - First commit to issue fork.
- Status changed to Needs review
6 months ago 7:06pm 26 June 2024 - 🇫🇮Finland sokru
I picked up this instead of ✨ Add 'Is empty (NULL)' and 'Is not empty (NOT NULL)' to field filter operators Needs work since this has working tests. Otherwise the "Proposed resolution" section seems rather identical with these two issues, calling for closing either of these or refining the issue summary.
- First commit to issue fork.
- Status changed to RTBC
5 months ago 6:46pm 22 July 2024 - 🇺🇸United States smustgrave
I marked ✨ Add 'Is empty (NULL)' and 'Is not empty (NOT NULL)' to field filter operators Needs work as PNMI for someone to confirm this ticket fixes the same issue, if not that issue should specify what didn't make it.
For this ticket
Ran the test-only feature
1) Drupal\Tests\views\Kernel\Handler\FilterBooleanOperatorTest::testEmptyFilterBooleanOperator Failed asserting that actual size 6 matches expected size 1. /builds/issue/drupal-3322402/core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorTest.php:161 FAILURES! Tests: 3, Assertions: 13, Failures: 1.
Show the test coverage.
Checking the issue summary, it appears complete with a matching solution to the MR.
Looking at the code I applied some small typehints for the new functions and the test.
I left
dataSet
andschemaDefinition
as those are inherited and probably could be a standalone ticket for applying throughout the repo.Rest appears to do as advertised.
-
longwave →
committed b6c02433 on 11.x
Issue #3322402 by idebr, smustgrave, Lendude, lind101, akalata, quietone...
-
longwave →
committed b6c02433 on 11.x
- Status changed to Fixed
5 months ago 5:21pm 7 August 2024 - 🇬🇧United Kingdom longwave UK
Nice to see these small features still getting attention, I've needed this before on a similar project and had to patch in support for it.
Committed b6c0243 and pushed to 11.x. Thanks!
Not eligible for backport as it's a new feature, anything building on this has to be targetted at 11.1 and above only.
Automatically closed - issue fixed for 2 weeks with no activity.