You are here

function mobile_tools_device_group_delete_confirm_submit in Mobile Tools 7.3

Handles form submission for the deletion of device groups

Parameters

$form:

&$form_state:

File

./mobile_tools.admin.inc, line 430
Adminstrative pages for Mobile Tools

Code

function mobile_tools_device_group_delete_confirm_submit($form, &$form_state) {
  if ($form_state['values']['confirm'] && isset($form_state['values']['dgid']) && !empty($form_state['values']['dgid']) && ($device_group = ctools_export_crud_load('mobile_tools_device_group', $form_state['values']['dgid']))) {
    ctools_export_crud_delete('mobile_tools_device_group', $device_group);

    // Deleting an export in code will revert it.
    $op = $device_group->export_type & EXPORT_IN_CODE ? 'Reverted' : 'Deleted';
    $message = t("Device group %dgid has been @action.", array(
      '%dgid' => check_plain($form_state['values']['dgid']),
      '@action' => t(drupal_strtolower($op)),
    ));
    drupal_set_message($message);
  }
  else {
    drupal_set_message(t("There was an error deleting device group %dgid.", array(
      '%dgid' => check_plain($form_state['values']['dgid']),
    )));
  }
  $form_state['redirect'] = 'admin/config/system/mobile-tools';
}