Skip to content
Snippets Groups Projects

Fix for #3345074, restore relay of parameters

1 file
+ 14
4
Compare changes
  • Side-by-side
  • Inline
@@ -349,13 +349,18 @@ class FormProcessorWebformHandler extends WebformHandlerBase {
@@ -349,13 +349,18 @@ class FormProcessorWebformHandler extends WebformHandlerBase {
}
}
}
}
 
/**
/**
* {@inheritdoc}
* @param \Drupal\webform\WebformSubmissionInterface $webform_submission
 
* @param $update
 
* @param $extraParams array used for example to add the results of a payment provider.
 
*
 
* @return void
*/
*/
public function postSave(WebformSubmissionInterface $webform_submission, $update = TRUE, $params = []) {
public function postSave(WebformSubmissionInterface $webform_submission, $update = TRUE, $extraParams = []) {
$state = $webform_submission->getWebform()->getSetting('results_disabled') ? WebformSubmissionInterface::STATE_COMPLETED : $webform_submission->getState();
$state = $webform_submission->getWebform()->getSetting('results_disabled') ? WebformSubmissionInterface::STATE_COMPLETED : $webform_submission->getState();
if ($this->configuration['states'] && in_array($state, $this->configuration['states'])) {
if ($this->configuration['states'] && in_array($state, $this->configuration['states'])) {
$this->sendToCiviCRM($webform_submission);
$this->sendToCiviCRM($webform_submission ,$extraParams);
}
}
}
}
@@ -368,10 +373,14 @@ class FormProcessorWebformHandler extends WebformHandlerBase {
@@ -368,10 +373,14 @@ class FormProcessorWebformHandler extends WebformHandlerBase {
}
}
}
}
 
/**
/**
* @param \Drupal\webform\WebformSubmissionInterface $webform_submission
* @param \Drupal\webform\WebformSubmissionInterface $webform_submission
 
* @param $extraParams array used for example to add the results of a payment provider.
 
*
 
* @return void
*/
*/
private function sendToCiviCRM(WebformSubmissionInterface $webform_submission) {
private function sendToCiviCRM(WebformSubmissionInterface $webform_submission, $extraParams = []) {
$data = $webform_submission->getData();
$data = $webform_submission->getData();
$fields = $this->formProcessorFields($this->configuration['connection'], $this->configuration['form_processor']);
$fields = $this->formProcessorFields($this->configuration['connection'], $this->configuration['form_processor']);
foreach ($fields as $key => $field) {
foreach ($fields as $key => $field) {
@@ -398,6 +407,7 @@ class FormProcessorWebformHandler extends WebformHandlerBase {
@@ -398,6 +407,7 @@ class FormProcessorWebformHandler extends WebformHandlerBase {
if ($this->configuration['form_processor_current_contact']) {
if ($this->configuration['form_processor_current_contact']) {
$params[$this->configuration['form_processor_current_contact']] = $this->getContactId();
$params[$this->configuration['form_processor_current_contact']] = $this->getContactId();
}
}
 
$params = array_merge($params,$extraParams);
$call = $this->core->createCall(
$call = $this->core->createCall(
$this->configuration['connection'],
$this->configuration['connection'],
'FormProcessor',
'FormProcessor',
Loading