Problem/Motivation
When trying to use the entity_view ctools content for a newly created entity (that is not necessarily saved yet) the content plugin throws an exception because it attempts to load the entity from the database, even if it already exists in the context object. This prevents the flexiform module from being able to render previews of an entity in multistep forms.
$entity_id = $context->argument;
$entity = entity_load_single($entity_type, $entity_id);
Proposed resolution
Alter the code such that, if $context->data is set, the entity already in $context->data is used instead of attempting to load a fresh copy.
Remaining tasks
User interface changes
None
API changes
None
Comments
Comment #1
rlmumfordAssigning to the right project
Comment #2
rlmumfordHere's a patch
Comment #3
andrewbelcher commentedThe previous patch meant that $entity_id wasn't always available. The updated patch ensures it always is.
Comment #4
chris matthews commentedThe 3 year old patch in #3 to entity_view.inc applied cleanly to the latest entity 7.x-1.x-dev and (if still relevant) needs review.