[Added] onActivate/ onDeactivate
Cette révision appartient à :
Parent
62ef191d47
révision
10386ccbf5
30
Setup/Actions.php
Fichier normal
30
Setup/Actions.php
Fichier normal
@ -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
Fichier normal
37
Setup/Events.php
Fichier normal
@ -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',
|
||||
],
|
||||
];
|
Chargement…
Référencer dans un nouveau ticket
Block a user