Issue:
When using Editable Fields as the Display formatter for an Entity Reference field, and the fallback formatter set to "entityreference_*", if the user views a node and does not have permission to edit, the fallback formatter is never displayed.
Expected behaviour:
The fallback formatter renders the field.
I tracked this down to the fact that the entityreference formatters expect field_prepare_view to have been called to load extra info about the entity. Editable fields clones the entity in editablefields_fallback_formatter, but it doesn't set $cloned_entity->_field_view_prepared to false. So, the entityreference formatter assumes that its hook_field_prepare_view had been called and doesn't load the entity data, resulting in the field not being shown.
Comment | File | Size | Author |
---|---|---|---|
#1 | editablefields-fallback-formatter-problem-2391375-2.patch | 558 bytes | acrazyanimal |
editablefields-fallback-formatter-problem-2391375-1.patch | 400 bytes | syastrov |
Comments
Comment #1
acrazyanimal CreditAttribution: acrazyanimal at OpenConcept Consulting Inc. commented@syastrov I can confirm the issue and also the solution. I have updated the patch just slightly to document it and to use
unset(...)
rather then setting the flag to FALSE. This is consistent with how the field.attach.inc does it.cheers!
Comment #2
acrazyanimal CreditAttribution: acrazyanimal at OpenConcept Consulting Inc. commentedComment #3
mducharme CreditAttribution: mducharme as a volunteer commented+1
Works as expected.
Comment #4
joelpittetWe don't RTBC our own patches, usually need someone else to test it out, maybe @mducharme could explain what they did for testing it? The fix looks simple enough I just want to understand in depth the problem being solved before committing it.