From b99c0cfff83e625e706ba1055b4a84f76dde810f Mon Sep 17 00:00:00 2001 From: hans rossel <16619-hansrossel@users.noreply.drupalcode.org> Date: Tue, 28 Jan 2025 05:18:56 +0000 Subject: [PATCH] 2.2.x Replace handler id's with handler providers --- .../cmrf_form_processor_mollie.module | 6 ++++-- .../src/EventSubscriber/MollieFormProcessorSubscriber.php | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/cmrf_form_processor_mollie/cmrf_form_processor_mollie.module b/modules/cmrf_form_processor_mollie/cmrf_form_processor_mollie.module index 135ad12..694c572 100644 --- a/modules/cmrf_form_processor_mollie/cmrf_form_processor_mollie.module +++ b/modules/cmrf_form_processor_mollie/cmrf_form_processor_mollie.module @@ -26,7 +26,8 @@ use Drupal\webform\Plugin\WebformHandlerInterface; function cmrf_form_processor_mollie_webform_handler_invoke_post_save_alter(WebformHandlerInterface $handler, array &$args) { /* makes only sense for form processors */ - if ($handler->getPluginId() != 'cmrf_form_processor') { + $plugin_definition = $handler->getPluginDefinition(); + if ($plugin_definition['provider'] != 'cmrf_form_processor') { return; } @@ -36,7 +37,8 @@ function cmrf_form_processor_mollie_webform_handler_invoke_post_save_alter(Webfo $handlers = $webform->getHandlers(); foreach ($handlers as $h) { - if ($h->getPluginId() == 'mollie_payment_handler') { + $plugin_definition = $h->getPluginDefinition(); + if ($plugin_definition['provider'] == 'mollie_webform') { $paymentHandler = $h; } } diff --git a/modules/cmrf_form_processor_mollie/src/EventSubscriber/MollieFormProcessorSubscriber.php b/modules/cmrf_form_processor_mollie/src/EventSubscriber/MollieFormProcessorSubscriber.php index a4e0988..850077e 100644 --- a/modules/cmrf_form_processor_mollie/src/EventSubscriber/MollieFormProcessorSubscriber.php +++ b/modules/cmrf_form_processor_mollie/src/EventSubscriber/MollieFormProcessorSubscriber.php @@ -40,7 +40,10 @@ class MollieFormProcessorSubscriber implements EventSubscriberInterface { $submission = $this->entityTypeManager->getStorage('webform_submission') ->load($event->getContextId()); $webform = $submission->getWebform(); - $handlers = $webform->getHandlers('cmrf_form_processor'); + $handlers = array_filter($webform->getHandlers(), function($handler) { + $plugin_definition = $handler->getPluginDefinition(); + return $plugin_definition['provider'] === 'cmrf_form_processor'; + }); $transaction = $this->entityTypeManager->getStorage('mollie_payment') ->load($event->getTransactionId()); -- GitLab