Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 300130

Default images for the Image field are not recording file usage properly

$
0
0

Problem/Motivation

There are 2 issues.
First, the image module hooks are adding file usage with \Drupal::service('file.usage')->add($file, 'image', 'default_image', $field_storage->uuid())
But file.usage expects 3rd parameter to be the entity type, not the arbitrary string, and the 4th parameter should be ID, not the UUID. Because of that visiting /admin/content/files/usage/{file_id} throws a 500.

Second, it was spotted while investigating the first issue. File usage records are not added at all if you add the default image while creating field (not updating existing)

Steps to reproduce

Add field type Image to any entity type.
Add default image (in storage or field config)
If the field is new, file usage is not added and the file is temporary
If updating, file usage is added, but with wrong parameters, so /admin/content/files/usage/{file_id} throws a 500 while trying to load the "default_image" entity type.

Proposed resolution

Add file usage records on field creation.
Change "default_image" and uuid used for file.usage table to entity type machine name (field_config and field_storage_config) and entity ID

Remaining tasks

-

User interface changes

-

Introduced terminology

-

API changes

-

Data model changes

-

Release notes snippet


Viewing all articles
Browse latest Browse all 300130

Latest Images

Trending Articles


Practice Sheet of Pronoun References for HSC Students


Download: Alice Chuma – Okondewa


Neem Baba Extra Questions Answer Class 6 English Poorvi


CalCen


Muloraki Au


Mahakal Attitude Status


Love (2015).H264.Italian.English.Ac3.5.1.multisub.iCV-MIRCrew Seed (62)/Leech...


MUSIC STATION – 2017.09.01


Waves Complete v2019.02.14 Incl Emulator-R2R


Students hit streets to save Agriculture College land in city



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>