diff --git a/Application/Controller/Admin/GA4AdminUserInterface_main.php b/Application/Controller/Admin/GA4AdminUserInterface_main.php index f857f2c..ee1d242 100644 --- a/Application/Controller/Admin/GA4AdminUserInterface_main.php +++ b/Application/Controller/Admin/GA4AdminUserInterface_main.php @@ -7,6 +7,7 @@ namespace D3\GoogleAnalytics4\Application\Controller\Admin; use D3\GoogleAnalytics4\Application\Model\Constants; use D3\GoogleAnalytics4\Application\Model\ManagerTypes; use OxidEsales\Eshop\Core\Registry; +use OxidEsales\Eshop\Core\ViewConfig; class GA4AdminUserInterface_main extends \OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController { @@ -92,6 +93,6 @@ class GA4AdminUserInterface_main extends \OxidEsales\Eshop\Application\Controlle */ public function d3GetModuleConfigParam(string $configParamName) { - return Registry::getConfig()->getShopConfVar(Constants::OXID_MODULE_ID.$configParamName, null, Constants::OXID_MODULE_ID); + return Registry::get(ViewConfig::class)->d3GetModuleConfigParam($configParamName); } } \ No newline at end of file diff --git a/Application/Model/ManagerHandler.php b/Application/Model/ManagerHandler.php index ef64abc..4fa4035 100644 --- a/Application/Model/ManagerHandler.php +++ b/Application/Model/ManagerHandler.php @@ -34,7 +34,7 @@ class ManagerHandler */ public function getModuleSettingExplicitManagerSelectValue() :string { - return Registry::getConfig()->getConfigParam('d3_gtm_settings_HAS_STD_MANAGER'); + return Registry::get(ViewConfig::class)->d3GetModuleConfigParam('_HAS_STD_MANAGER'); } /** diff --git a/Modules/Core/ViewConfig.php b/Modules/Core/ViewConfig.php index 670d1cc..685ca34 100644 --- a/Modules/Core/ViewConfig.php +++ b/Modules/Core/ViewConfig.php @@ -34,10 +34,7 @@ class ViewConfig extends ViewConfig_parent { if ($this->sContainerId === null) { - $this->sContainerId = ContainerFactory::getInstance() - ->getContainer() - ->get(ModuleSettingBridgeInterface::class) - ->get('d3_gtm_sContainerID', Constants::OXID_MODULE_ID); + $this->sContainerId = $this->d3GetModuleConfigParam("_sContainerID"); } return $this->sContainerId; } @@ -60,7 +57,7 @@ class ViewConfig extends ViewConfig_parent */ public function shallUseOwnCookieManager() :bool { - return (bool) Registry::getConfig()->getConfigParam('d3_gtm_settings_hasOwnCookieManager'); + return (bool) $this->d3GetModuleConfigParam('_blEnableOwnCookieManager'); } /** @@ -78,7 +75,7 @@ class ViewConfig extends ViewConfig_parent $this->defineCookieManagerType(); - $sCookieID = trim($oConfig->getConfigParam('d3_gtm_settings_controlParameter')); + $sCookieID = trim($this->d3GetModuleConfigParam('_sControlParameter')); // Netensio Cookie Manager if ($this->sCookieManagerType === ManagerTypes::NET_COOKIE_MANAGER) { @@ -120,7 +117,7 @@ class ViewConfig extends ViewConfig_parent */ public function getGtmScriptAttributes() :string { - $sControlParameter = trim(Registry::getConfig()->getConfigParam('d3_gtm_settings_controlParameter')); + $sControlParameter = trim($this->d3GetModuleConfigParam('_sControlParameter')); if (false === $this->shallUseOwnCookieManager() or ($sControlParameter === '')){ return ""; @@ -160,10 +157,7 @@ class ViewConfig extends ViewConfig_parent { if ($this->blGA4enabled === null) { - $this->sContainerId = ContainerFactory::getInstance() - ->getContainer() - ->get(ModuleSettingBridgeInterface::class) - ->get('d3_gtm_blEnableGA4', Constants::OXID_MODULE_ID); + $this->sContainerId = $this->d3GetModuleConfigParam("d3_gtm_blEnableGA4"); } return $this->blGA4enabled; @@ -171,10 +165,7 @@ class ViewConfig extends ViewConfig_parent public function isGtmConsentModeSetActivated() :bool { - return $this->sContainerId = ContainerFactory::getInstance() - ->getContainer() - ->get(ModuleSettingBridgeInterface::class) - ->get('d3_gtm_blActivateConsentMode', Constants::OXID_MODULE_ID); + return $this->sContainerId = $this->d3GetModuleConfigParam("_blEnableConsentMode"); } public function getGtmDataLayer() @@ -216,7 +207,7 @@ class ViewConfig extends ViewConfig_parent public function isDebugModeOn() :bool { - return Registry::getConfig()->getConfigParam('d3_gtm_blEnableDebug'); + return $this->d3GetModuleConfigParam("_blEnableDebug"); } public function isPromotionList($listId) @@ -232,10 +223,7 @@ class ViewConfig extends ViewConfig_parent */ public function getServerSidetaggingJsDomain() :string { - return ContainerFactory::getInstance() - ->getContainer() - ->get(ModuleSettingBridgeInterface::class) - ->get('d3_gtm_settings_serversidetagging_js', Constants::OXID_MODULE_ID); + return $this->d3GetModuleConfigParam("_sServersidetagging_js"); } /** @@ -245,9 +233,15 @@ class ViewConfig extends ViewConfig_parent */ public function getServerSidetaggingNoJsDomain() :string { - return ContainerFactory::getInstance() - ->getContainer() - ->get(ModuleSettingBridgeInterface::class) - ->get('d3_gtm_settings_serversidetagging_nojs', Constants::OXID_MODULE_ID); + return $this->d3GetModuleConfigParam('_sServersidetagging_nojs'); + } + + /** + * @param string $configParamName + * @return mixed + */ + public function d3GetModuleConfigParam(string $configParamName) + { + return Registry::getConfig()->getShopConfVar(Constants::OXID_MODULE_ID.$configParamName, null, Constants::OXID_MODULE_ID); } } \ No newline at end of file