Usage of Files Referenced in Entity Reference Fields Not Tracked

Created on 9 November 2016, over 8 years ago
Updated 21 July 2025, 18 days ago

Problem/Motivation

I have an entity reference field type for file entities on a custom block type. When a file is added (referenced) on the field, the usage is not recorded. This is a problem if you enable orphan file deletion.

Before working on this read 🌱 Dealing with unexpected file deletion due to incorrect file usage Active .

Steps to reproduce

Proposed resolution

TBD

Remaining tasks

TBD

User interface changes

N/A

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component

file system

Created by

πŸ‡ΊπŸ‡ΈUnited States dobrzyns

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

    Believe this is still a valid issue, tested by

    Standard profile install
    Add a reference field to the Article content type
    Using other > select file
    Uploaded a file on another node
    Verified the usage is 1
    Created an Article that references that file I uploaded
    Usage is still 1.

  • First commit to issue fork.
  • πŸ‡³πŸ‡±Netherlands arjenk

    added a unittest that confirms the tested scenario. The suggestion in https://www.drupal.org/project/drupal/issues/2826127#comment-12156312 πŸ› Usage of Files Referenced in Entity Reference Fields Not Tracked Active will likely fix the issue, although after reading #2821423, this seems not the way to go.

Production build 0.71.5 2024