From 1e2a88e8216b879d46ff38317ef4e86e540ebc13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Ruz=CC=8Cevic=CC=81?= Date: Wed, 17 Jan 2024 10:39:37 +0100 Subject: [PATCH] updating block admin enque --- src/Helpers/UtilsApiHelper.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Helpers/UtilsApiHelper.php b/src/Helpers/UtilsApiHelper.php index 2bdfb18..0cf391d 100644 --- a/src/Helpers/UtilsApiHelper.php +++ b/src/Helpers/UtilsApiHelper.php @@ -149,17 +149,16 @@ public static function getIntegrationApiPublicOutput(array $formDetails, string $additionalOutput = []; - $allowedOutput = [ - UtilsConfig::FD_SUCCESS_REDIRECT => UtilsHelper::getStateResponseOutputKey('successRedirect'), - UtilsConfig::FD_ADDON => UtilsHelper::getStateResponseOutputKey('addon'), - UtilsConfig::IARD_VALIDATION => UtilsHelper::getStateResponseOutputKey('validation'), - ]; + if (isset($formDetails[UtilsConfig::FD_SUCCESS_REDIRECT])) { + $additionalOutput[UtilsHelper::getStateResponseOutputKey('successRedirect')] = $formDetails[UtilsConfig::FD_SUCCESS_REDIRECT]; + } - // Populate additional output with allowed keys and aproppriate allowed output keys used in JS. - foreach ($allowedOutput as $key => $value) { - if (isset($response[$key])) { - $additionalOutput[$value] = $response[$value]; - } + if (isset($formDetails[UtilsConfig::FD_ADDON])) { + $additionalOutput[UtilsHelper::getStateResponseOutputKey('addon')] = $formDetails[UtilsConfig::FD_ADDON]; + } + + if (isset($response[UtilsConfig::IARD_VALIDATION])) { + $additionalOutput[UtilsHelper::getStateResponseOutputKey('validation')] = $response[UtilsConfig::IARD_VALIDATION]; } if ($status === UtilsConfig::STATUS_SUCCESS) {