While trying out module Entity Embed, I ran into a problem that whenever I chose to have the embedded image display as "Rendered File", nothing would show #2634350: "Rendered File" plugin doesn't work. I eventually traced the problem to file_entity_field_formatter_view(), where the file was being put into a recursion queue that didn't actually do anything!
I searched to see why that code was there and found #1447186: Rendered File formatter doesn't respect Field Display settings in Media Browser and #2061625: The 'Rendered file' formatter should not be available as a checkbox on the 'Manage file display' tab that indicate that the whole recursion queue scheme was abandoned 2 years ago, but the code was never taken out!
I propose that it be taken out now so that embedded files can be rendered.
Comment | File | Size | Author |
---|---|---|---|
#14 | 2640106-fix-formatter-rendered.patch | 2 KB | Dave Reid |
| |||
#12 | 2640106-fix-formatter-rendered.patch | 1.75 KB | Dave Reid |
| |||
#11 | 2640106-fix-formatter-rendered.patch | 1.75 KB | Dave Reid |
| |||
#9 | 2640106-fix-formatter-rendered.patch | 1.15 KB | Dave Reid |
| |||
#8 | 2640106-fix-formatter-rendered.patch | 1.12 KB | Dave Reid |
|
Comments
Comment #2
aDarkling CreditAttribution: aDarkling as a volunteer commentedComment #3
Devin Carlson CreditAttribution: Devin Carlson commentedComment #4
Devin Carlson CreditAttribution: Devin Carlson commentedTested #2 and committed with some additional code cleanup.
Comment #6
derekw CreditAttribution: derekw commentedI just updated from the february dev to april 21 dev and my images are now not displaying.
Line 286 of file_entity_field.inc now has:
If I dsm($Item) it has $item['fid'] but not $item['file']. The $item appears to be the file. So the test if ($empty($item['file'])) is failing...and no images are being displayed.
Comment #7
Dave ReidI think there's also a problem with the follow-up committed with http://cgit.drupalcode.org/file_entity/commit/?id=f74eb9a - we need to make sure that we're returning the field formatter output indexed by the correct $delta values.
Comment #8
Dave ReidBased on file_field_load() and what all of our other formatters do, we should be converting $item to an object to render it. I also wanted to simplify and unify this with the entity reference field formatter.
Comment #9
Dave ReidUpdated correct call to file_view().
Comment #10
Dave ReidAlso, I'm *pretty sure* we're going to break something outside of this module with this removal of this code:
That code came with #2333107: Allow file formatter to known the type of the referencing entity.
Comment #11
Dave ReidThis re-adds the references. I tried to go back through all the code that touched this formatter to make sure we are accounting for regressions. #1784762: File description lost when using Rendered file formatter and Generic file display is accounted for since $item['description'] will get converted to $file->description now.
Comment #12
Dave ReidGot rid of the exception and just logging it instead now, more like D8.
Comment #13
Dave ReidComment #14
Dave ReidUsing more D8 style of counting recursion, but left out $instance['bundle'] because it seems like Entity Embed in D7 doesn't have $instance['bundle'].
Comment #15
mattltHello,
The commit related to this issue…
http://cgit.drupalcode.org/file_entity/commit/?id=e17e4b82793b4e8c5ea6e9...
And possibly related to the cleanup after…
http://cgit.drupalcode.org/file_entity/commit/?id=f74eb9a856c4443366e332...
…caused our sites not to be able to render files referenced by both views and panels.
Reverting the cleanup commit seemed to get the files back, but then I had the errors. Reverting both got everything working back to normal. We are not using the Entity Embed module so I'm not sure how that relates.
Not sure where to go from here other than letting you know the above changes broke our installs.
Please let me know if you have any questions.
Thanks,
•• matt
Comment #17
Dave ReidCommitted #14 to 7.x-2.x.