You are here

function client_delete_confirm_submit in Web Service Clients 7.2

Same name and namespace in other branches
  1. 6.2 clients.module \client_delete_confirm_submit()
  2. 7 clients.module \client_delete_confirm_submit()

Form submit handler for the deletion form.

@todo: refactor?

File

./clients.connection.admin.inc, line 344
clients.connection.admin.inc Page callbacks relating to client connection admin.

Code

function client_delete_confirm_submit($form, &$form_state) {
  $cid = (int) $form_state['values']['cid'];
  if ($form_state['values']['type'] == 'connection') {
    $num_deleted = db_delete('clients_connections')
      ->condition('cid', $cid)
      ->execute();
    if ($num_deleted) {
      drupal_set_message(t('Connection @name deleted.', array(
        '@name' => $form_state['values']['name'],
      )));
      $form_state['redirect'] = 'admin/structure/clients/connections';
    }
    else {
      drupal_set_message(t('Problem deleting connection @name.', array(
        '@name' => $form_state['values']['name'],
      )), 'error');
    }
  }
}