function wf_crm_update_existing_component in Webform CiviCRM Integration 7.5
Same name and namespace in other branches
- 7.3 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
stdClass $node:
2 calls to wf_crm_update_existing_component()
- wf_crm_admin_form::postProcess in includes/
wf_crm_admin_form.inc - Submission handler, saves CiviCRM options for a Webform node
- _webform_edit_civicrm_contact in includes/
contact_component.inc - Implements _webform_edit_component().
File
- includes/
contact_component.inc, line 863
Code
function wf_crm_update_existing_component(&$component, $enabled, $data, $node) {
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, $node);
if ($allow_create != $component['extra']['allow_create']) {
$component['extra']['none_prompt'] = $allow_create ? t('+ Create new +') : t('- None Found -');
$component['extra']['allow_create'] = $allow_create;
webform_component_update($component);
}
}
}