You are here

function sarnia_entity_delete_form_submit in Sarnia 7

File

./sarnia.entities.inc, line 231

Code

function sarnia_entity_delete_form_submit($form, &$form_state) {
  $server = $form_state['values']['server'];
  $entity_type_machine_name = sarnia_entity_server_name_load($server->machine_name);

  // Delete the entity type.
  sarnia_entity_type_delete($entity_type_machine_name);

  // Rebuild the entity info cache and the menus, so that tabs provided by the
  // Field UI module disappear immediately.
  entity_info_cache_clear();
  menu_rebuild();

  // Tell the user what just happened.
  drupal_set_message(t('Deleted the Sarnia entity type and a Search API index for the %server_name server.', array(
    '%server_name' => $server->name,
  )));
  $form_state['redirect'] = 'admin/config/search/search_api/server/' . $server->machine_name . '/sarnia';
}