Skip to content

Instantly share code, notes, and snippets.

@pbuyle
Created October 15, 2012 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pbuyle/3893987 to your computer and use it in GitHub Desktop.
Save pbuyle/3893987 to your computer and use it in GitHub Desktop.
Fun with entity_view
function fun_with_entity_view($entity, $entity_type, $view_mode, $langcode) {
list($entity_id) = entity_extract_ids($entity_type, $entity);
if ($view_mode === 'full') {
$entity->content['teaser'] = entity_view(entity_load($entity_type, $entity_id), $entity_type, 'teaser', $langcode);
}
}
@pbuyle
Copy link
Author

pbuyle commented Oct 15, 2012

EntityAPIController::buildContent reset build content with $entity->content = $content;, nesting entity_view() invocation on the same entity does not work as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment