You are here

protected function wf_crm_webform_base::getExposedOptions in Webform CiviCRM Integration 7.4

Same name and namespace in other branches
  1. 7.5 includes/wf_crm_webform_base.inc \wf_crm_webform_base::getExposedOptions()

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

Parameters

$field_key: Field key

array $exclude: Options to ignore

Return value

array

8 calls to wf_crm_webform_base::getExposedOptions()
wf_crm_webform_base::loadContact in includes/wf_crm_webform_base.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_webform_postprocess::fillDataFromSubmission in includes/wf_crm_webform_postprocess.inc
Fill data array with submitted form values
wf_crm_webform_postprocess::processParticipants in includes/wf_crm_webform_postprocess.inc
Process event participation for a contact
wf_crm_webform_postprocess::saveGroupsAndTags in includes/wf_crm_webform_postprocess.inc
Save groups and tags for a contact
wf_crm_webform_postprocess::updateContact in includes/wf_crm_webform_postprocess.inc
Update a contact

... See full list

File

includes/wf_crm_webform_base.inc, line 544

Class

wf_crm_webform_base
Class wf_crm_webform_base

Code

protected function getExposedOptions($field_key, $exclude = array()) {
  $field = $this
    ->getComponent($field_key);
  if ($field && $field['type'] == 'hidden') {

    // Fetch live options
    $exposed = wf_crm_field_options($field, 'live_options', $this->data);
    foreach ($exclude as $i) {
      unset($exposed[$i]);
    }
    return $exposed;
  }
  if ($field && $field['type'] == 'select') {

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