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.
Found when debugging some fails in #1969728: Implement Field API "field types" as TypedData Plugins.
When an uploaded file is configured not to be displayed, file_field_prepare_view() simply deletes it from the list of values.
This affects the entity for the rest of the request.
That's not how it should work, items that are supposed to remain hidden should stay out of the way, but they cannot be simply removed.
Comment | File | Size | Author |
---|---|---|---|
#14 | file_prepare_view-2020677-followup-14.patch | 2.41 KB | yched |
#1 | file_prepare_view-2020677-1.patch | 6.29 KB | yched |
Comments
Comment #1
yched CreditAttribution: yched commentedPatch.
#2020677: file_field_prepare_view() should not delete items currently needs to include some of those fixes, so in a way it is blocked by this.
Thus, adding the corresponding tags...
Comment #2
yched CreditAttribution: yched commentedComment #3
fagoTotally. I agree that's a reasonable improvement.
Patch looks good to me -> RTBC.
Comment #4
fagoComment #5
fagoComment #6
alexpottCommitted 2635b66 and pushed to 8.x. Thanks!
Comment #7
Dave ReidThis will need a change notice for anyone that has written file or image formatters.
Comment #8
Dave ReidComment #9
fagoComment #10
aspilicious CreditAttribution: aspilicious commentedMaking this a task :)
Comment #11
scor CreditAttribution: scor commentedupdate tags (normalize to "Needs change notification")
Comment #12
yched CreditAttribution: yched commentedChange notice added at https://drupal.org/node/2047939
Comment #13
yched CreditAttribution: yched commentedresetting priority
Comment #14
yched CreditAttribution: yched commentedFollowup: formatters should use the helper FileFormatterBase::isDisplayed($item) method that was added in the late iterations of #1969728: Implement Field API "field types" as TypedData Plugins.
(the code example provided in the change notice linked above already does so)
Once #2015697: Convert field type to typed data plugin for file and image modules is done, this isDisplayed() method would be better off moved to the FileItem class, but for now it has to stay in FileFormatterBase.
Comment #16
yched CreditAttribution: yched commented#14: file_prepare_view-2020677-followup-14.patch queued for re-testing.
Comment #17
yched CreditAttribution: yched commentedBump :-)
Comment #18
yched CreditAttribution: yched commentedMoved #14 to a separate issue at #2090619: Move file visibility check to the FileItem class.
Putting this one back to fixed.
Comment #19.0
(not verified) CreditAttribution: commentedadded issue link