Skip to content

Instantly share code, notes, and snippets.

@jitendrapurohit
Last active November 10, 2021 08:48
Show Gist options
  • Save jitendrapurohit/6e03c5b6f6294713ba995aa53acd6420 to your computer and use it in GitHub Desktop.
Save jitendrapurohit/6e03c5b6f6294713ba995aa53acd6420 to your computer and use it in GitHub Desktop.
diff --git a/src/Plugin/WebformHandler/CivicrmWebformHandler.php b/src/Plugin/WebformHandler/CivicrmWebformHandler.php
index c410e90..ad56b0c 100644
--- a/src/Plugin/WebformHandler/CivicrmWebformHandler.php
+++ b/src/Plugin/WebformHandler/CivicrmWebformHandler.php
@@ -142,11 +142,11 @@ class CivicrmWebformHandler extends WebformHandlerBase {
/**
* {@inheritdoc}
*/
- public function postSave(WebformSubmissionInterface $webform_submission, $update = TRUE) {
- $this->civicrm->initialize();
- $processor = \Drupal::service('webform_civicrm.postprocess')->initialize($webform_submission->getWebform());
- $processor->postSave($webform_submission);
- }
+ // public function postSave(WebformSubmissionInterface $webform_submission, $update = TRUE) {
+ // $this->civicrm->initialize();
+ // $processor = \Drupal::service('webform_civicrm.postprocess')->initialize($webform_submission->getWebform());
+ // $processor->postSave($webform_submission);
+ // }
/**
* {@inheritdoc}
diff --git a/webform_civicrm.module b/webform_civicrm.module
index 4f84fda..d0f75d6 100644
--- a/webform_civicrm.module
+++ b/webform_civicrm.module
@@ -13,6 +13,7 @@ use Drupal\webform\Entity\WebformSubmission;
use Drupal\node\Entity\Node;
use Drupal\Core\Template\Attribute;
use Drupal\Core\Url;
+use Drupal\webform\WebformSubmissionInterface;
/**
* The versions of CiviCRM and WebForm. Min is >=. Max is <. FALSE = no MAX
@@ -62,6 +63,12 @@ function webform_civicrm_datetime_set_format($element) {
return $element;
}
+function webform_civicrm_webform_submission_post_transaction(WebformSubmissionInterface $webform_submission) {
+ \Drupal::service('civicrm')->initialize();
+ $processor = \Drupal::service('webform_civicrm.postprocess')->initialize($webform_submission->getWebform());
+ $processor->postSave($webform_submission);
+}
+
/**
* Implements hook_form_alter().
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment