Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Button icons are lost after cron run because there icons are not tracked with cores file.usage
service.
Proposed resolution
Maintain file usage information with CRUD hooks.
Remaining tasks
Test
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#18 | track-button-file-usage-2537786-18.patch | 8.74 KB | Devin Carlson |
#18 | track-button-file-usage-2537786-18-tests-only.patch | 2.19 KB | Devin Carlson |
#16 | track-button-file-usage-2537786-16.patch | 8.73 KB | Devin Carlson |
#8 | 2537786-8.patch | 8.9 KB | webflo |
Comments
Comment #1
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedComment #2
Dave ReidHrm, are the files not getting set as a permanent file to begin with? That should have prevented this in the first place, but I agree that adding usage is good. I think this code might need to be in the Entity class itself possibly, and not in a hook.
Comment #4
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedFiles are temporary by default.
FileFieldItemList::postSave
maintains the file usage for file and image fields. I implemented it as hooks because thought it's not the concern of the entity to integrate in other subsystems.Comment #5
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedComment #6
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedThis line is not necessary. I remove it during the next reroll.
Comment #8
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedComment #10
Dave ReidBecause the icon is an integral part of the config entity itself and not something optional, I don't think hooks seem like something useful for this.
If this were true then the file module would be implementing hooks scanning for file and image field references for tracking usage, instead of it being part of the file and image fields themselves.
Comment #11
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedLatest patch is on GitHub https://github.com/drupal-media/entity_embed/pull/151
Comment #12
Dave ReidComment #15
Devin Carlson CreditAttribution: Devin Carlson commentedComment #16
Devin Carlson CreditAttribution: Devin Carlson commentedA backport of #13.
Comment #18
Devin Carlson CreditAttribution: Devin Carlson commentedComment #20
Devin Carlson CreditAttribution: Devin Carlson commentedTested #18 and committed to Entity Embed 3.x, 2.x and 1.x.