Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
- Write patch
User interface changes
None
API changes
None
Comment | File | Size | Author |
---|---|---|---|
#3 | 2506781-3.patch | 706 bytes | andrewbelcher |
Comments
Comment #1
rlmumfordAssigning to the right project
Comment #2
rlmumfordHere's a patch
Comment #3
andrewbelcher CreditAttribution: andrewbelcher at FreelyGive commentedThe previous patch meant that $entity_id wasn't always available. The updated patch ensures it always is.
Comment #4
Chris Matthews CreditAttribution: Chris Matthews as a volunteer 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.