You are here

function mass_contact_admin_delete in Mass Contact 7

Same name and namespace in other branches
  1. 5.2 mass_contact.module \mass_contact_admin_delete()
  2. 5 mass_contact.module \mass_contact_admin_delete()
  3. 6 mass_contact.module \mass_contact_admin_delete()

Displays a form to select a category to delete.

Parameters

array $form: An associative array containing the structure of the form.

array $form_state: A keyed array containing the current state of the form.

int $cid: The id of the category to delete.

Return value

array A confirmation form for the user to acknowledge.

1 string reference to 'mass_contact_admin_delete'
mass_contact_menu in ./mass_contact.module
Implements hook_menu().

File

./mass_contact.admin.inc, line 247
The administrative settings pages.

Code

function mass_contact_admin_delete(array $form, array $form_state, $cid = NULL) {
  $info = db_select('mass_contact', 'mc')
    ->fields('mc', array(
    'category',
  ))
    ->condition('cid', $cid)
    ->execute()
    ->fetchObject();
  if ($info) {
    $form['category'] = array(
      '#type' => 'value',
      '#value' => $info->category,
    );
    return confirm_form($form, t('Are you sure you want to delete %category?', array(
      '%category' => $info->category,
    )), 'admin/config/system/mass_contact', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
  }
  else {
    drupal_set_message(t('Category not found.'), 'error');
    drupal_goto('admin/config/system/mass_contact');
  }
}