function wf_crm_name_field_exists in Webform CiviCRM Integration 7.5
Same name and namespace in other branches
- 7.3 webform_civicrm_utils.inc \wf_crm_name_field_exists()
- 7.4 includes/utils.inc \wf_crm_name_field_exists()
Check if a (non-disabled) name or email field exists for this contact. This determines whether a new contact can be created on the webform.
Parameters
$enabled: Array of enabled fields
$c: Contact #
$contact_type: Contact type
stdClass $node:
Return value
int
3 calls to wf_crm_name_field_exists()
- wf_crm_admin_form::insertComponent in includes/
wf_crm_admin_form.inc - Add a CiviCRM field to a webform
- wf_crm_update_existing_component in includes/
contact_component.inc - Update existing component if other fields have been added or removed
- wf_crm_webform_postprocess::loadMultiPageData in includes/
wf_crm_webform_postprocess.inc - Load entire webform submission during validation, including contact ids and $this->data Used when validation for one page needs access to submitted values from other pages
File
- includes/
utils.inc, line 1727 - Webform CiviCRM module's common utility functions.
Code
function wf_crm_name_field_exists($enabled, $c, $contact_type, $node) {
foreach (wf_crm_required_contact_fields($contact_type) as $f) {
$fid = 'civicrm_' . $c . '_contact_1_' . $f['table'] . '_' . $f['name'];
if (!empty($enabled[$fid]) && empty($node->webform['components'][$enabled[$fid]]['extra']['disabled'])) {
return 1;
}
}
return 0;
}