Skip to content

Commit

Permalink
Issue #3375337: only call civi in hook if handler enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
herbdool committed Jul 18, 2023
1 parent 192a3ac commit bb81ad1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion webform_civicrm.module
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,13 @@ function _fillCiviCRMData($data, $webformSubmission) {
return $data;
}

$webform = $webformSubmission->getWebform();
$has_webform_civicrm_handler = $webform->getHandlers(NULL, TRUE)->has('webform_civicrm');
if (!$has_webform_civicrm_handler) {
return $data;
}
\Drupal::service('civicrm')->initialize();
$utils = \Drupal::service('webform_civicrm.utils');
$webform = $webformSubmission->getWebform();
foreach ($data as $key => $val) {
$element = $webform->getElement($key);
if ($element && !empty($val) && $element['#type'] == 'civicrm_options') {
Expand Down

0 comments on commit bb81ad1

Please sign in to comment.