Problem/Motivation

When using the 'rendered file' formatter on a file display view mode it is completely ineffective and never renders anything.

Set up a file display view mode that only uses the 'rendered file' formatter as a setting for that formatter choose a different view mode that simply renders a file using something simple. Don't choose any other formatter as a fallback.
Insert a media item into a wysiwyg, and choose the view mode that you set up above.
When viewing the content, you will see media's fallback rendering of the media, rather than the rendered file as wanted.

This is because the rendered file formatter uses a 'recursion queue' to stop itself rendering itself, but it is too aggressive and doesn't let itself be rendered at all!

Proposed resolution

#5 moves the addition of the current entity to the queue after the initial decision to render the file or not, it also allows the formatter to render other view modes without incurring the recursion queue.

Remaining tasks

Needs review.

User interface changes

None

API changes

This will possibly mean that some people who are using this formatter and its doing nothing at the moment will find it doing something.

Original report by rlmumford

This may be a problem elsewhere as well, but noticed it when playing with the media browser. When rendering a file directly, the fid was put in the $recursion_queue, which caused the the rest of the function to skip over viewing it even though there was zero danger of recursion occuring (because $entity->referencing_entity still wasn't set).

Comments

rlmumford’s picture

StatusFileSize
new614 bytes

And here's a patch that solves the problem...

rlmumford’s picture

rlmumford’s picture

Status: Active » Needs review
steven jones’s picture

We've come across the same problem, but with a slight twist, we need a slight relaxation of the rules of the reference queue so that we can render the same entity but with a different view mode. It seems that doing this with files is fine, unlike nodes.

Patch to follow.

stevetweeddale’s picture

StatusFileSize
new1.33 KB

Alternative approach attached...

dave reid’s picture

Could I have some steps to reproduce this bug at all?

steven jones’s picture

@Dave Reid I've updated the issue summary.

griz’s picture

Patch works for me. Without it no additional fields are displayed with an image inserted from Media via WYSIWYG. With it they are shown.

ParisLiakos’s picture

aaron’s picture

dave reid’s picture

Hrm, what is the use case for actually using the 'Rendered File' formatter in the 'Manage file display' tab? We're debating removing it in #2061625: The 'Rendered file' formatter should not be available as a checkbox on the 'Manage file display' tab

aaron’s picture

Status: Needs review » Closed (works as designed)

I am closing this issue as we have now removed the rendered file option entirely.

aaron’s picture

Issue summary: View changes

Updated issue summary.