Created
October 15, 2012 17:56
-
-
Save pbuyle/3893987 to your computer and use it in GitHub Desktop.
Fun with entity_view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
EntityAPIController::buildContent reset build content with
$entity->content = $content;
, nesting entity_view() invocation on the same entity does not work as expected.