Add ‘allow empty’ for ‘File Usage’ Views Filters

Created on 16 June 2017, almost 7 years ago
Updated 24 January 2023, over 1 year ago

Problem/Motivation

In Views, it’s currently not possible to filter File Usage fields (module, type, id, and count) by either ‘Is empty (NULL)’ or ‘Is not empty (NOT NULL)’.

Proposed resolution

Add ‘allow empty’ => TRUE to these definitions for Views.

For example:

    $data['file_usage']['module'] = [
      'title' => $this->t('Module'),
      'help' => $this->t('The module managing this file relationship.'),
      'field' => [
        'id' => 'standard',
       ],
      'filter' => [
        'id' => 'string',
+        'allow empty' => TRUE,
      ],
      'argument' => [
        'id' => 'string',
      ],
      'sort' => [
        'id' => 'standard',
      ],
    ];

Remaining tasks

  • Do we need to update some tests for this?

User interface changes

None

API changes

None

Data model changes

None

Feature request
Status

Postponed: needs info

Version

10.1

Component
File module 

Last updated 3 days ago

Created by

🇺🇸United States Chris Burge

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

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

  • 🇺🇸United States smustgrave

    This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.

    Tried replicating in D10 with a standard install
    Uploaded 2 images, 1 attached to a node the other not.
    Edited the files view to filter by file usage with setting not null
    I see 1 file that's attached to node

    Edit the files view to filter by file usage with setting null
    I see 1 files that's not attached to node

    This appears to work could someone else verify.
    If still a valid feature request it will need a test case to show the issue.

Production build 0.69.0 2024