function wf_crm_update_existing_component in Webform CiviCRM Integration 7.3
Same name and namespace in other branches
- 7.5 includes/contact_component.inc \wf_crm_update_existing_component()
- 7.4 includes/contact_component.inc \wf_crm_update_existing_component()
Update existing component if other fields have been added or removed
Parameters
$component: Webform component of type 'civicrm_contact' (reference)
$enabled: Array of enabled fields
$data: Array of crm entity data
2 calls to wf_crm_update_existing_component()
- wf_crm_configure_form_submit in ./
webform_civicrm_admin.inc - Submission handler, saves CiviCRM options for a Webform node
- _webform_edit_civicrm_contact in ./
contact_component.inc - Implements _webform_edit_component().
File
- ./
contact_component.inc, line 785
Code
function wf_crm_update_existing_component(&$component, $enabled, $data) {
list(, $c, ) = explode('_', $component['form_key'], 3);
if (!empty($data['contact'][$c])) {
$contact_type = $data['contact'][$c]['contact'][1]['contact_type'];
$allow_create = wf_crm_name_field_exists($enabled, $c, $contact_type);
if ($allow_create != $component['extra']['allow_create']) {
$component['extra']['none_prompt'] = $allow_create ? t('+ Create new contact +') : t('- None Found -');
$component['extra']['allow_create'] = $allow_create;
webform_component_update($component);
}
}
}