getDefinitions(); foreach ($entity_info as $entity_type => $info) { if ($entity_info[$entity_type]->getProvider() == 'devel_entity_test_canonical' && !isset($view_modes[$entity_type])) { $view_modes[$entity_type] = array( 'full' => array( 'label' => t('Full object'), 'status' => TRUE, 'cache' => TRUE, ), 'teaser' => array( 'label' => t('Teaser'), 'status' => TRUE, 'cache' => TRUE, ), ); } } }