You are here

function entity_view_mode_delete in Entity view modes 7

Delete a custom entity view mode.

1 call to entity_view_mode_delete()
entity_view_mode_delete_form_submit in ./entity_view_mode.admin.inc
1 string reference to 'entity_view_mode_delete'
entity_view_mode_hook_info in ./entity_view_mode.module
Implements hook_hook_info().

File

./entity_view_mode.module, line 196

Code

function entity_view_mode_delete($entity_type, $machine_name) {
  if ($view_mode = entity_view_mode_load($entity_type, $machine_name)) {
    module_invoke_all('entity_view_mode_delete', $view_mode, $entity_type);
    $view_modes = variable_get('entity_view_modes', array());
    unset($view_modes[$entity_type][$machine_name]);
    variable_set('entity_view_modes', $view_modes);

    // Clear the static entity info cache and rebuild the menu.
    entity_info_cache_clear();
    variable_set('menu_rebuild_needed', TRUE);
  }
}