function crm_core_relationship_ui_add_relationship_form_submit in CRM Core 8.3
Same name and namespace in other branches
- 8 modules/crm_core_relationship_ui/crm_core_relationship_ui.pages.inc \crm_core_relationship_ui_add_relationship_form_submit()
- 8.2 modules/crm_core_relationship_ui/crm_core_relationship_ui.pages.inc \crm_core_relationship_ui_add_relationship_form_submit()
- 7 modules/crm_core_relationship_ui/crm_core_relationship_ui.pages.inc \crm_core_relationship_ui_add_relationship_form_submit()
Perform submit for add relationship form. Save relationship.
1 string reference to 'crm_core_relationship_ui_add_relationship_form_submit'
- crm_core_relationship_form in modules/
crm_core_relationship_ui/ crm_core_relationship_ui.pages.inc - Form builder for CRM Activity forms.
File
- modules/
crm_core_relationship_ui/ crm_core_relationship_ui.pages.inc, line 356 - CRM Core Relationship UI Pages.
Code
function crm_core_relationship_ui_add_relationship_form_submit($form, &$form_state) {
$relationship_type = $form_state['values']['relationship_type'];
$reverse = $form_state['values']['reverse'];
$source_contact = _crm_core_relationship_ui_get_contact_from_autocomplete_field_value($form_state['values']['source_contact']);
$destination_contact = _crm_core_relationship_ui_get_contact_from_autocomplete_field_value($form_state['values']['destination_contact']);
$relation = $form_state['relation'];
$relation
->save();
field_attach_submit('relation', $relation, $form, $form_state);
$redirect_contact = $reverse ? $destination_contact : $source_contact;
$form_state['redirect'] = 'crm-core/contact/' . $redirect_contact->contact_id . '/relationships/';
}