Base field filter operators do not include "Is empty (NULL)" and "Is not empty (NOT NULL)"

Created on 3 December 2019, over 5 years ago
Updated 19 May 2023, almost 2 years ago

I'm not quite sure if this should be a bug or a feature request.

If a base field on an entity's base table is used as a filter criteria, there are no operator choices for "Is empty (NULL)" and "Is not empty (NOT NULL)".

I discovered this with a custom entity when I wanted to find null values. The only example I can find in core uses the file entity.

Steps to reproduce.

  1. Create a view for files.
  2. Add a filter criteria. Select filename as the field.
  3. Note that "Is empty (NULL)" and "Is not empty (NOT NULL)" do not appear in the operator selection.

I think it is a reasonable expectation to be able to search for null and not null. I know "allow empty" can be added per entity in a views_data handler or a hook_views_data or hook_views_data_alter but is there any reason this shouldn't be added automatically?

✨ Feature request
Status

Needs work

Version

10.1 ✨

Component
Views  →

Last updated about 4 hours ago

Created by

🇺🇸United States tetranz

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024