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.
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 66 - Interface elements for adding, editing, and otherwise working with contact types.
Code
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');
}