You are here

function wf_crm_contact_fields in Webform CiviCRM Integration 7.4

Same name and namespace in other branches
  1. 7.5 includes/contact_component.inc \wf_crm_contact_fields()
  2. 7.3 contact_component.inc \wf_crm_contact_fields()

Find exposed field groups for a contact

Parameters

$node: Node object

$con: Contact #

Return value

array

2 calls to wf_crm_contact_fields()
_webform_edit_civicrm_contact in includes/contact_component.inc
Implements _webform_edit_component().
_webform_render_civicrm_contact in includes/contact_component.inc
Implements _webform_render_component().

File

includes/contact_component.inc, line 833

Code

function wf_crm_contact_fields($node, $con) {
  $ret = array();
  $sets = wf_crm_get_fields('sets');
  $sets['name'] = array(
    'label' => t('Name'),
  );
  foreach ($node->webform['components'] as $f) {
    if ($pieces = wf_crm_explode_key($f['form_key'])) {
      list(, $c, $ent, , $table, $field) = $pieces;
      if ($ent == 'contact' && $c == $con && isset($sets[$table])) {

        // Separate name from other contact fields
        if ($table == 'contact' && strpos($field, 'name')) {
          $table = 'name';
        }
        if ($field != 'existing') {
          $ret[$table] = $sets[$table]['label'];
        }
      }
    }
  }
  return $ret;
}