The problem is that file_entity_field_formatter_view() passes along the langcode of the field but if that's und, then entity_translation complains about there being no translation for that.

entityreference solved that with a new setting that always uses the current content language if enabled: https://www.drupal.org/node/1674792. Drupal 8 solved it by expliictly passing the render language down to the formatters.

This is a quick and dirty start of a patch that uses the entity_reference approach but only when the language is und by unsetting the langcode, which means it will fallback to the content language. Also didn't add a setting for it yet, but it probably will need one to be committed. An alternative would be to add a bit more logic and e.g. check for entity_translation and if a translation for current content language is available, then use that explicitly.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir created an issue. See original summary.

Berdir’s picture

Status: Active » Needs review
FileSize
784 bytes

Here's a patch. Working for us (tm).

joseph.olstad’s picture

Status: Needs review » Fixed

Thanks @berdir

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.