function entity_view_mode_entity_view in Entity view modes 7
Implements hook_entity_view().
See also
File
- ./
entity_view_mode.module, line 327
Code
function entity_view_mode_entity_view($entity, $entity_type, $view_mode, $langcode) {
// Add context and variables necessary to entity_view_mode_preprocess().
list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
$entity->content['#entity_view_mode'] = array(
'entity_type' => $entity_type,
'id' => $id,
'bundle' => $bundle,
'view_mode' => $view_mode,
'langcode' => $langcode,
'has_bundles' => TRUE,
);
if ($entity_type == $bundle) {
$info = entity_get_info($entity_type);
if (empty($info['entity keys']['bundle'])) {
$entity->content['#entity_view_mode']['has_bundles'] = FALSE;
}
}
}