add usercentrics chosable settings-value; add additional methods; add new multilang-idents

This commit is contained in:
MaxBUhe 2023-05-23 14:33:35 +02:00
parent dfdc5d5edf
commit 6fca52cc06
3 changed files with 26 additions and 12 deletions

View File

@ -31,8 +31,10 @@ $aLang = [
// for cookie manager settings // for cookie manager settings
'SHOP_MODULE_GROUP_d3_gtm_settings_cookiemanager' => 'Cookie Manager Einstellungen', 'SHOP_MODULE_GROUP_d3_gtm_settings_cookiemanager' => 'Cookie Manager Einstellungen',
'SHOP_MODULE_d3_gtm_settings_hasOwnCookieManager' => 'Cookie Manager nutzen?', 'SHOP_MODULE_d3_gtm_settings_hasOwnCookieManager' => 'Cookie Manager nutzen?',
'SHOP_MODULE_d3_gtm_settings_HAS_CONSENTMANAGER' => 'Nutzen Sie die Consentmanager-Einbindung?', 'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER' => 'Nutzen Sie eine der folgenden Einbindungen?<br>
'SHOP_MODULE_d3_gtm_settings_HAS_CONSENTMANAGER_NO' => 'Nein', Dann wählen Sie bitte die zutreffende aus.',
'SHOP_MODULE_d3_gtm_settings_HAS_CONSENTMANAGER_YES' => 'Ja', 'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_NONE' => '---',
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_CONSENTMANAGER' => 'consentmanager',
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_USERCENTRICS' => 'usercentrics',
'SHOP_MODULE_d3_gtm_settings_cookieName' => 'CookieID', 'SHOP_MODULE_d3_gtm_settings_cookieName' => 'CookieID',
]; ];

View File

@ -33,9 +33,21 @@ class ViewConfig extends ViewConfig_parent
return $this->sContainerId; return $this->sContainerId;
} }
public function getModuleConsentmanagerSettingSelectValue() :bool /**
* @return mixed
*/
public function getModuleSettingExplicitManagerSelectValue()
{ {
return Registry::getConfig()->getConfigParam('d3_gtm_settings_HAS_CONSENTMANAGER') === 'YES'; return Registry::getConfig()->getConfigParam('d3_gtm_settings_HAS_STD_MANAGER');
}
/**
* @return false|mixed
*/
public function getExplicitManager()
{
$sManagerName = $this->getModuleSettingExplicitManagerSelectValue();
return $sManagerName === "---" ? false : $sManagerName;
} }
public function getCookieManagerType() public function getCookieManagerType()
@ -58,8 +70,8 @@ class ViewConfig extends ViewConfig_parent
} }
} }
if ($this->sCookieManagerType === false and $this->getModuleConsentmanagerSettingSelectValue()){ if ($this->sCookieManagerType === false and $this->getExplicitManager()){
return "consentmanager"; return "externalService";
} }
return $this->sCookieManagerType; return $this->sCookieManagerType;
@ -96,7 +108,7 @@ class ViewConfig extends ViewConfig_parent
} }
// UserCentrics // UserCentrics
if ($this->getCookieManagerType() === "oxps_usercentrics" or $this->getCookieManagerType() === 'consentmanager') { if ($this->getCookieManagerType() === "oxps_usercentrics" or $this->getCookieManagerType() === 'externalService') {
// Always needs the script-tags delivered to the DOM. // Always needs the script-tags delivered to the DOM.
return true; return true;
} }
@ -114,7 +126,7 @@ class ViewConfig extends ViewConfig_parent
{ {
$oConfig = Registry::getConfig(); $oConfig = Registry::getConfig();
if ($this->getCookieManagerType() == "oxps_usercentrics") { if ($this->getCookieManagerType() === "oxps_usercentrics" or $this->getExplicitManager() === 'usercentrics') {
$sCookieId = $oConfig->getConfigParam('d3_gtm_settings_cookieName'); $sCookieId = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
if ($sCookieId) { if ($sCookieId) {
@ -122,7 +134,7 @@ class ViewConfig extends ViewConfig_parent
} }
} }
if ($this->getCookieManagerType() == "consentmanager") { if ($this->getCookieManagerType() === "externalService" and $this->getExplicitManager() === 'consentmanager') {
$sCookieId = $oConfig->getConfigParam('d3_gtm_settings_cookieName'); $sCookieId = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
if ($sCookieId) { if ($sCookieId) {

View File

@ -122,10 +122,10 @@ $aModule = [
], ],
[ [
'group' => 'd3_gtm_settings_cookiemanager', 'group' => 'd3_gtm_settings_cookiemanager',
'name' => 'd3_gtm_settings_HAS_CONSENTMANAGER', 'name' => 'd3_gtm_settings_HAS_STD_MANAGER',
'type' => 'select', 'type' => 'select',
'value' => 'none', 'value' => 'none',
'constraints' => 'NO|YES', 'constraints' => 'NONE|CONSENTMANAGER|USERCENTRICS',
], ],
] ]
]; ];