From fe281c2705b95bae0decb96a6d915c3affbe6ca0 Mon Sep 17 00:00:00 2001 From: Lars Steen Risom Date: Fri, 10 Dec 2021 11:22:42 +0100 Subject: [PATCH 1/2] SUPPORT-354: Adding missing key to element selection --- src/Plugin/WebformHandler/DigitalPostWebformHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Plugin/WebformHandler/DigitalPostWebformHandler.php b/src/Plugin/WebformHandler/DigitalPostWebformHandler.php index 3a14954..9f7a272 100644 --- a/src/Plugin/WebformHandler/DigitalPostWebformHandler.php +++ b/src/Plugin/WebformHandler/DigitalPostWebformHandler.php @@ -191,7 +191,7 @@ private function getAvailableElements(array $elements): array { continue; } - $availableElements[] = $element['#title']; + $availableElements[$key] = $element['#title']; } return $availableElements; From c506e3993af5293794ca83ebe0a583b0cc5f05e5 Mon Sep 17 00:00:00 2001 From: Lars Steen Risom Date: Fri, 10 Dec 2021 11:23:36 +0100 Subject: [PATCH 2/2] SUPPORT-354: Adding check for cpr element in submission --- src/Exception/CprElementNotFoundInSubmissionException.php | 5 +++++ src/Plugin/WebformHandler/DigitalPostWebformHandler.php | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 src/Exception/CprElementNotFoundInSubmissionException.php diff --git a/src/Exception/CprElementNotFoundInSubmissionException.php b/src/Exception/CprElementNotFoundInSubmissionException.php new file mode 100644 index 0000000..f699bc1 --- /dev/null +++ b/src/Exception/CprElementNotFoundInSubmissionException.php @@ -0,0 +1,5 @@ +configuration['cpr_element'], $submissionData)) { + $this->getLogger()->error( + 'The chosen CPR element not found in submission!' + ); + + throw new \CprElementNotFoundInSubmissionException(); + } + /** @var \Drupal\os2forms_cpr_lookup\CPR\CprServiceResult $cprSearchResult */ $cprSearchResult = $this->cprService->search($submissionData[$this->configuration['cpr_element']]);