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).
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | file_entity-recursionqueue-1447186-5.patch | 1.33 KB | stevetweeddale |
| #1 | rendered-file-formatter-fix-1447186-1.patch | 614 bytes | rlmumford |
Comments
Comment #1
rlmumfordAnd here's a patch that solves the problem...
Comment #2
rlmumfordComment #3
rlmumfordComment #4
steven jones commentedWe'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.
Comment #5
stevetweeddale commentedAlternative approach attached...
Comment #6
dave reidCould I have some steps to reproduce this bug at all?
Comment #7
steven jones commented@Dave Reid I've updated the issue summary.
Comment #8
griz commentedPatch works for me. Without it no additional fields are displayed with an image inserted from Media via WYSIWYG. With it they are shown.
Comment #9
ParisLiakos commented#5: file_entity-recursionqueue-1447186-5.patch queued for re-testing.
Comment #10
aaron commented#5: file_entity-recursionqueue-1447186-5.patch queued for re-testing.
Comment #11
dave reidHrm, 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
Comment #12
aaron commentedI am closing this issue as we have now removed the rendered file option entirely.
Comment #12.0
aaron commentedUpdated issue summary.