Implements hook_entity_view_mode_info_alter().
function field_test_entity_view_mode_info_alter(&$view_modes) {
$entity_info = entity_get_info();
foreach ($entity_info as $entity_type => $info) {
if ($entity_info[$entity_type]['module'] == 'field_test') {
$view_modes[$entity_type] = array(
'full' => array(
'label' => t('Full object'),
'status' => TRUE,
),
'teaser' => array(
'label' => t('Teaser'),
'status' => TRUE,
),
);
}
}
}