I need to have a list of all available view modes for an entity type so I can use it as the
#options in a select field.
Any ideas? Thanks
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
I think you are talking about view modes for entities.
$entity_info = entity_get_info('node'); debug(array_keys($entity_info['view modes']));
It would result as
array ( 0 => 'full', 1 => 'teaser', 2 => 'rss', 3 => 'search_index', 4 => 'search_result', )
You may also want to use this function...