Problem/Motivation
I tested the upgrade of one of my first Drupal 8 projects to 8.5.0. Because of its age the site is using file_entity.
After the upgrade I saw, that all image thumbnails in the node forms showed Drupal's internal file uri public://images/test.jpg instead of the rendered thumbnail image. While investigating I saw, that the Field Formatter Widget for "URI" changed at /admin/structure/file-types/manage/image/edit/display/thumbnail.
Instead of "File URI", "File Image", "Plain text" only "File URI" is available. That explains what I see in the node form. It seems that field type changed, so that the FieldFormatter is not matching anymore.
I changed
@FieldFormatter(
* id = "file_image",
* label = @Translation("File Image"),
* field_types = {
* "uri"
* }
* )to
@FieldFormatter(
* id = "file_image",
* label = @Translation("File Image"),
* field_types = {
* "file_uri"
* }
* )And the FileImageFormatter came back again and worked as designated.
I haven't followed the changes that went into in 8.5.0, but it might be #2825487: Fix normalization of File entities: file entities should expose the file URL as a computed property on the 'uri' base field or one of its related issues, that cause the trouble.
Screenshot from Project Drupal 8.4.5:

Screenshot from fresh Drupal 8.5.0 install and enabled file_entity

The issue is visible in file_entity 8.x-2.x-dev and 8.x-2.0-beta4.
Do you experience the same?
Proposed resolution
- Find out what in core caused the issue
- Add new field type to the FieldFormatter annotation to make it available in Drupal 8.5.0
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | file_entity-fileimageformatter_not_available_d85-2951451-9.patch | 506 bytes | szeidler |
| #6 | file_entity-fileimageformatter_not_available_d85-2951451-2.stable.patch | 512 bytes | weseze |
| #2 | file_entity-fileimageformatter_not_available_d85-2951451-2.patch | 1020 bytes | szeidler |
| field-formatters-8.5.png | 114.74 KB | szeidler | |
| field-formatters-8.4.png | 133.43 KB | szeidler |
Comments
Comment #2
szeidlerThe attached patch (for 8.x-2.x-dev) makes the FileImageFormatter and FileImageResponsiveFormatter available in Drupal 8.5.0 by adding the
file_urifile type in addition to make it work with Drupal 8.4 and 8.5.Comment #3
webflo commentedI have the same issue, thanks for the patch.
Comment #4
jonmcl commentedAm I missing something or is this a major change that seems to be missing clear change record? The linked issue, and CR, seem to be all about the JSON API, but this is a field type change? I would think this would break a few things.
Thank you for the patch! Hopefully this it is all that is needed.
Comment #5
Huelfe commentedPatch works fine for me. Thank you! :)
Comment #6
weseze commentedSeems like a major regression in D8.5 when using file_entity...
The patch fixes the issue!
Attached is a patch against latest stable '8.x-2.0-beta4 released 10 August 2017' which doesn't have the responsive formatter yet.
Comment #8
joseph.olstadfixed in dev branch 8.x-2.x-dev
Comment #9
szeidlerThanks for the prompt commit.
Sorry for reopening the issue, but I think we should fix for the Responsive Image Formatter (from dev) as well, like I did in patch #2.
I created a new patch based on the current dev, that is just adding it.
Comment #10
webflo commentedComment #12
joseph.olstadwill this break backwards compatibility?
Comment #13
esolitosI did test the patch on 8.4 and seems to be working fine.
Haven't done a deep test, just applied and manually tested a few use cases: No error, notices or anything visibly broken.