You are here

function crm_core_contact_ui_type_delete_confirm in CRM Core 7

Given a contact type, present a form prompting for deletion of the contact type.

Parameters

$form: The confirmation form.

$form_state: The state of the form.

$contact_type: The machine readable name of the contact type to be deleted.

File

modules/crm_core_contact_ui/crm_core_contact_ui.admin.inc, line 120
Interface elements for adding, editing, and otherwise working with contact types.

Code

function crm_core_contact_ui_type_delete_confirm($form, &$form_state, $contact_type) {
  $form_state['contact_type'] = $contact_type;
  $form['message'] = array(
    '#markup' => t('Are you sure you want to delete this contact type?  All contacts of this type will be deleted.'),
  );
  $form['actions'] = array(
    '#type' => 'container',
    '#attributes' => array(
      'class' => array(
        'form-actions',
      ),
    ),
    '#weight' => 40,
  );

  // We add the form's #submit array to this button along with the actual submit
  // handler to preserve any submit handlers added by a form callback_wrapper.
  $submit = array();
  if (!empty($form['#submit'])) {
    $submit += $form['#submit'];
  }
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Delete contact type'),
    '#submit' => $submit + array(
      'crm_core_contact_ui_type_delete_confirm_submit',
    ),
  );
  return $form;
}