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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

acrazyanimal’s picture

@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!

acrazyanimal’s picture

Status: Active » Reviewed & tested by the community
mducharme’s picture

+1

Works as expected.

joelpittet’s picture

Version: 7.x-1.0-alpha2 » 7.x-1.x-dev
Status: Reviewed & tested by the community » Needs review

We 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.