Hi,

I am implementing an "embed" solution for entities. Entities are stored in mongodb and entityreference fields can embed the referenced entity within the field. Therefor, at the load time, field items already have the referenced entity loaded, along with the target_id.

The problem is that hook_field_formatter_prepare_view loads the referenced entity anyway.

Is there a way to avoid this?

Thanks,
Mihai

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mihai_brb’s picture

I attached a first patch. This solution works for me. I am not sure if this will break something, so any feedback is appreciated.

This approach is somehow inspired from what field collection module does here:
http://api.drupalecommerce.org/api/misc/field_collection!field_collectio...

Thanks,
Mihai