You are here

function wf_crm_exposed_options in Webform CiviCRM Integration 7.3

For a given field, find the options that are exposed to the webform.

Parameters

$node: Node object

$fid: Numeric webform component id

$exclude: Options to ignore

Return value

array

4 calls to wf_crm_exposed_options()
wf_crm_contact_get in ./webform_civicrm_forms.inc
Fetch all relevant data for a given contact Used to load contacts for pre-filling a webform, and also to fill in a contact via ajax
wf_crm_process_submission in ./webform_civicrm_forms.inc
Webform submission handler Create/update CiviCRM contacts and related data Called by presave, insert and update webform hooks
_wf_crm_form_data in ./webform_civicrm_forms.inc
Dispatch function to fill data array with submitted form values Called during webform submission
_wf_crm_frontend_form_alter in ./webform_civicrm_forms.inc
Alter front-end of webforms: Called by hook_form_alter() when rendering a civicrm-enabled webform Add custom prefix. Display messages. Block users who should not have access. Set webform default values.

File

./webform_civicrm_forms.inc, line 1231

Code

function wf_crm_exposed_options($node, $fid, $exclude = array()) {
  if ($fid) {
    $field = $node->webform['components'][$fid];
    if ($field['type'] == 'select') {

      // Fetch static options
      if (empty($field['extra']['civicrm_live_options'])) {
        $exposed = wf_crm_str2array($node->webform['components'][$fid]['extra']['items']);
      }
      else {
        $exposed = wf_crm_field_options($field, 'live_options', $node->webform_civicrm['data']);
      }
      foreach ($exclude as $i) {
        unset($exposed[$i]);
      }
      return $exposed;
    }
  }
  return array();
}