private function WebformCivicrmPreProcess::loadURLEvents in Webform CiviCRM Integration 8.5
Load event data for the url
Parameters
int $c:
1 call to WebformCivicrmPreProcess::loadURLEvents()
- WebformCivicrmPreProcess::alterForm in src/
WebformCivicrmPreProcess.php - 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
- src/
WebformCivicrmPreProcess.php, line 381 - Front-end form pre-processor.
Class
Namespace
Drupal\webform_civicrmCode
private function loadURLEvents($c) {
$n = $this->data['participant_reg_type'] == 'separate' ? $c : 1;
$p = wf_crm_aval($this->data, "participant:{$n}:participant");
if ($p) {
foreach ($p as $e => $value) {
$event_ids = [];
// Get the available event list from the component
$fid = "civicrm_{$c}_participant_{$e}_participant_event_id";
$eids = [];
foreach ($this
->getExposedOptions($fid) as $eid => $title) {
$id = explode('-', $eid);
$eids[$id[0]] = $eid;
}
if ($this->data['participant_reg_type'] == 'all') {
$urlParam = "event{$e}";
}
else {
$urlParam = "c{$c}event{$e}";
}
foreach (explode(',', wf_crm_aval($_GET, $urlParam)) as $url_param_value) {
if (isset($eids[$url_param_value])) {
$event_ids[] = $eids[$url_param_value];
}
}
$this->info['participant'][$c]['participant'][$e]['event_id'] = $event_ids;
}
}
}