[Added] onActivate/ onDeactivate
This commit is contained in:
parent
62ef191d47
commit
10386ccbf5
30
Setup/Actions.php
Normal file
30
Setup/Actions.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace D3\GoogleAnalytics4\Setup;
|
||||
|
||||
|
||||
use D3\GoogleAnalytics4\Application\Model\Constants;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
|
||||
class Actions
|
||||
{
|
||||
/**
|
||||
* @param string $sVarType
|
||||
* @param string $sSettingName
|
||||
* @param string $sSettingValue
|
||||
* @return void
|
||||
*/
|
||||
public function d3SaveDefaultSettings(string $sVarType, string $sSettingName, string $sSettingValue){
|
||||
$oConfig = Registry::getConfig();
|
||||
|
||||
$oConfig->saveShopConfVar(
|
||||
$sVarType,
|
||||
Constants::OXID_MODULE_ID.$sSettingName,
|
||||
$sSettingValue,
|
||||
$oConfig->getShopId(),
|
||||
Constants::OXID_MODULE_ID
|
||||
);
|
||||
}
|
||||
}
|
37
Setup/Events.php
Normal file
37
Setup/Events.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace D3\GoogleAnalytics4\Setup;
|
||||
|
||||
|
||||
class Events
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public static function onActivate()
|
||||
{
|
||||
$oActions = oxNew(Actions::class);
|
||||
$oActions->d3SaveDefaultSettings(
|
||||
'str',
|
||||
'_sServersidetagging_js',
|
||||
'https://www.googletagmanager.com/gtm.js'
|
||||
);
|
||||
$oActions->d3SaveDefaultSettings(
|
||||
'str',
|
||||
'_sServersidetagging_js',
|
||||
'https://www.googletagmanager.com/ns.html'
|
||||
);
|
||||
$oActions->d3SaveDefaultSettings(
|
||||
'str',
|
||||
'_sContainerID',
|
||||
'GTM-'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public static function onDeactivate(){}
|
||||
}
|
@ -175,5 +175,9 @@ $aModule = [
|
||||
'file' => '/Application/views/blocks/remove_from_cart.tpl',
|
||||
'position' => 150
|
||||
]
|
||||
]
|
||||
],
|
||||
'events' => [
|
||||
'onActivate' => '\D3\GoogleAnalytics4\Setup\Events::onActivate',
|
||||
'onDeactivate' => '\D3\GoogleAnalytics4\Setup\Events::onDeactivate',
|
||||
],
|
||||
];
|
Loading…
Reference in New Issue
Block a user