You are here

function crm_core_contact_ui_type_toggle_form in CRM Core 7

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


$form: The confirmation form.

$form_state: The state of the form.

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


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


function crm_core_contact_ui_type_toggle_form($form, &$form_state, $contact_type, $toggle = 'disable') {
  $form_state['contact_type'] = $contact_type;
  $form['op'] = array(
    '#type' => 'value',
    '#value' => check_plain($toggle),
  $question = t('Are you sure you want to @toggle this contact type?', array(
    '@toggle' => $toggle,
  $path = 'admin/structure/crm-core/contact-types';
  $description = '';
  if ($toggle == 'disable') {
    $description = t('When a contact type is disabled, you cannot add any contacts to this contact type. You will also not be able to search for contacts of disabled contact type.');
  return confirm_form($form, $question, $path, $description, check_plain($toggle), 'Cancel', 'toggle_confirm');