[Fixed] over-engineered Getter-methods
- the methods would semi-automatic search and set/ save params - I removed those and set it back to its base functionality: -- saving happens ONLY at the save() function if triggered by the user in the admin-frontend -- only one Getter who checks for a value in the DB ? give the value : no value given yet
This commit is contained in:
@ -21,7 +21,7 @@ class GA4AdminUserInterface_main extends \OxidEsales\Eshop\Application\Controlle
|
||||
$this->addTplParam('d3ViewObject', $this);
|
||||
$this->addTplParam('d3ViewConfObject', Registry::get(ViewConfig::class));
|
||||
$this->addTplParam('d3ManagerTypeArray', oxNew(ManagerTypes::class)->getManagerList());
|
||||
$this->addTplParam('d3CurrentCMP', oxNew(ManagerHandler::class)->getCurrManager());
|
||||
$this->addTplParam('d3CurrentCMP', oxNew(ManagerHandler::class)->getActManager());
|
||||
|
||||
return $return;
|
||||
}
|
||||
@ -41,10 +41,10 @@ class GA4AdminUserInterface_main extends \OxidEsales\Eshop\Application\Controlle
|
||||
'_blEnableUsercentricsConsentModeApi',
|
||||
];
|
||||
|
||||
foreach ($aCheckBoxParams as $checkBoxName) {
|
||||
if (isset($aParams['bool'][$checkBoxName])) {
|
||||
foreach ($aCheckBoxParams as $checkBoxName){
|
||||
if (isset($aParams['bool'][$checkBoxName])){
|
||||
$aParams['bool'][$checkBoxName] = true;
|
||||
} else {
|
||||
}else{
|
||||
$aParams['bool'][$checkBoxName] = false;
|
||||
}
|
||||
}
|
||||
@ -60,8 +60,8 @@ class GA4AdminUserInterface_main extends \OxidEsales\Eshop\Application\Controlle
|
||||
{
|
||||
$oConfig = Registry::getConfig();
|
||||
foreach ($aParams as $sConfigType => $aConfigParams) {
|
||||
foreach ($aConfigParams as $sParamName => $sParamValue) {
|
||||
if ($this->d3GetModuleConfigParam($sParamName) !== $sParamValue) {
|
||||
foreach ($aConfigParams as $sParamName => $sParamValue){
|
||||
if($this->d3GetModuleConfigParam($sParamName) !== $sParamValue){
|
||||
$oConfig->saveShopConfVar(
|
||||
$sConfigType,
|
||||
Constants::OXID_MODULE_ID.$sParamName,
|
||||
@ -82,4 +82,4 @@ class GA4AdminUserInterface_main extends \OxidEsales\Eshop\Application\Controlle
|
||||
{
|
||||
return Registry::get(ViewConfig::class)->d3GetModuleConfigParam($configParamName);
|
||||
}
|
||||
}
|
||||
}
|
@ -7,41 +7,11 @@ use OxidEsales\Eshop\Core\ViewConfig;
|
||||
|
||||
class ManagerHandler
|
||||
{
|
||||
/**
|
||||
* Gets current chosen Manager
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrManager(): string
|
||||
{
|
||||
/** @var ManagerTypes $oManagerTypes */
|
||||
$oManagerTypes = oxNew(ManagerTypes::class);
|
||||
|
||||
/** @var ViewConfig|\D3\GoogleAnalytics4\Modules\Core\ViewConfig $oViewConfig */
|
||||
$oViewConfig = oxNew(ViewConfig::class);
|
||||
|
||||
$aManagerList = $oManagerTypes->getManagerList();
|
||||
|
||||
if ($this->getModuleSettingExplicitManagerSelectValue()) {
|
||||
return $this->getExplicitManager();
|
||||
}
|
||||
|
||||
foreach ($aManagerList as $shopModuleId => $publicCMPName) {
|
||||
if ($oViewConfig->d3IsModuleActive($shopModuleId)) {
|
||||
$this->d3SaveShopConfVar($shopModuleId);
|
||||
return $shopModuleId;
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sParam
|
||||
* @return void
|
||||
*/
|
||||
public function d3SaveShopConfVar(string $sParam)
|
||||
{
|
||||
public function d3SaveShopConfVar(string $sParam){
|
||||
Registry::getConfig()->saveShopConfVar(
|
||||
'select',
|
||||
Constants::OXID_MODULE_ID."_HAS_STD_MANAGER",
|
||||
@ -54,26 +24,8 @@ class ManagerHandler
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getModuleSettingExplicitManagerSelectValue(): string
|
||||
public function getActManager() :string
|
||||
{
|
||||
return Registry::get(ViewConfig::class)->d3GetModuleConfigParam('_HAS_STD_MANAGER') ?: "";
|
||||
return Registry::get(ViewConfig::class)->d3GetModuleConfigParam('_HAS_STD_MANAGER')?:"";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getExplicitManager(): string
|
||||
{
|
||||
$sPotentialManagerName = $this->getModuleSettingExplicitManagerSelectValue();
|
||||
|
||||
/** @var ManagerTypes $oManagerTypes */
|
||||
$oManagerTypes = oxNew(ManagerTypes::class);
|
||||
$sCMPName = $oManagerTypes->isManagerInList($sPotentialManagerName)
|
||||
? $sPotentialManagerName
|
||||
: "NONE";
|
||||
|
||||
$this->d3SaveShopConfVar($sCMPName);
|
||||
|
||||
return $sCMPName;
|
||||
}
|
||||
}
|
||||
}
|
@ -54,7 +54,7 @@ class ViewConfig extends ViewConfig_parent
|
||||
if ($this->sCookieManagerType === null) {
|
||||
/** @var ManagerHandler $oManagerHandler */
|
||||
$oManagerHandler = oxNew(ManagerHandler::class);
|
||||
$this->sCookieManagerType = $oManagerHandler->getCurrManager();
|
||||
$this->sCookieManagerType = $oManagerHandler->getActManager();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user