You are here

function view_mode_selector_view_modes in View Mode Selector 7

Helper function which returns all view modes of an entity type.

Parameters

string $entity_type: The specific entity type.

Return value

array An array containing all view modes of the entity type.

2 calls to view_mode_selector_view_modes()
view_mode_selector_field_instance_settings_form in ./view_mode_selector.module
Implements hook_field_instance_settings_form().
view_mode_selector_field_widget_form in ./view_mode_selector.module
Implements hook_field_widget_form().

File

./view_mode_selector.module, line 400
Main file of View Mode Selector module.

Code

function view_mode_selector_view_modes($entity_type) {
  $entity_info = entity_get_info($entity_type);

  // Add 'Default' view mode to all view modes in order
  // to allow switching to it.
  $view_modes = array(
    'default' => array(
      'label' => t('Default'),
      'custom settings' => TRUE,
    ),
  ) + $entity_info['view modes'];

  // The 'View mode selector' view mode is only for allow switching.
  unset($view_modes['view_mode_selector']);
  return $view_modes;
}