@@ -57,7 +57,7 @@ index 0000000..c378f45
5757+ }
5858+ }
5959diff --git a/src/Plugin/rest/resource/WebformSubmissionResource.php b/src/Plugin/rest/resource/WebformSubmissionResource.php
60- index d2e08c5..a9cacf7 100644
60+ index ebe22aa..4102129 100644
6161--- a/src/Plugin/rest/resource/WebformSubmissionResource.php
6262+++ b/src/Plugin/rest/resource/WebformSubmissionResource.php
6363@@ -5,6 +5,7 @@ namespace Drupal\webform_rest\Plugin\rest\resource;
@@ -67,11 +67,11 @@ index d2e08c5..a9cacf7 100644
6767+ use Drupal\webform_rest\Event\WebformSubmissionDataEvent;
6868 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
6969 use Symfony\Component\DependencyInjection\ContainerInterface;
70-
71- @@ -35 ,6 +36 ,13 @@ class WebformSubmissionResource extends ResourceBase {
72- */
73- protected $request ;
74-
70+
71+ @@ -43 ,6 +44 ,13 @@ class WebformSubmissionResource extends ResourceBase {
72+
73+ protected $currentUser ;
74+
7575+ /**
7676+ * An event dispatcher instance to use for dispatching events.
7777+ *
@@ -82,18 +82,18 @@ index d2e08c5..a9cacf7 100644
8282 /**
8383 * {@inheritdoc}
8484 */
85- @@ -42,6 +50,7 @@ class WebformSubmissionResource extends ResourceBase {
86- $instance = parent::create($container, $configuration, $plugin_id, $plugin_definition);
85+ @@ -51,6 +59,7 @@ class WebformSubmissionResource extends ResourceBase {
8786 $instance->entityTypeManager = $container->get('entity_type.manager');
8887 $instance->request = $container->get('request_stack');
88+ $instance->currentUser = $container->get('current_user');
8989+ $instance->eventDispatcher = $container->get('event_dispatcher');
9090 return $instance;
9191 }
92-
93- @@ -91 ,9 +100 ,13 @@ class WebformSubmissionResource extends ResourceBase {
92+
93+ @@ -110 ,9 +119 ,13 @@ class WebformSubmissionResource extends ResourceBase {
9494 // Grab submission data.
9595 $data = $webform_submission->getData();
96-
96+
9797+ // Dispatch WebformSubmissionDataEvent to allow modification of data.
9898+ $event = new WebformSubmissionDataEvent($webform_submission, $data);
9999+ $this->eventDispatcher->dispatch($event);
@@ -103,5 +103,5 @@ index d2e08c5..a9cacf7 100644
103103- 'data' => $data,
104104+ 'data' => $event->getData(),
105105 ];
106-
106+
107107 // Return the submission.
0 commit comments