function crm_core_contact_ui_form_submit in CRM Core 7
Submit callback for crm_core_contact_ui_form().
1 string reference to 'crm_core_contact_ui_form_submit'
- crm_core_contact_ui_form in modules/
crm_core_contact_ui/ crm_core_contact_ui.pages.inc - Form callback: create or edit a contact.
File
- modules/
crm_core_contact_ui/ crm_core_contact_ui.pages.inc, line 115
Code
function crm_core_contact_ui_form_submit($form, &$form_state) {
global $user;
$create = FALSE;
$contact =& $form_state['crm_core_contact'];
// Set the contact's uid if it's being created at this time.
if (empty($contact->contact_id)) {
$contact->uid = $user->uid;
$create = TRUE;
}
// Notify field widgets.
field_attach_submit('crm_core_contact', $contact, $form, $form_state);
// Save the contact
crm_core_contact_save($contact);
// Redirect based on the button clicked.
drupal_set_message(t('Contact saved.'));
$form_state['redirect'] = $create ? 'crm-core/contact' : "crm-core/contact/{$contact->contact_id}";
}