ltsecurityinc安防产品在线商城代码
This commit is contained in:
+75
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2022 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license/ End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\CookieConsent\Setup\Patch\Data;
|
||||
|
||||
use Magento\Config\Model\ResourceModel\Config\Data\CollectionFactory;
|
||||
use Magento\Eav\Setup\EavSetupFactory;
|
||||
use Magento\Framework\App\Config\Storage\WriterInterface;
|
||||
use Magento\Framework\Setup\Patch\DataPatchInterface;
|
||||
use Plumrocket\CookieConsent\Helper\Config;
|
||||
|
||||
/**
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class DisableConsentModeForOldClients implements DataPatchInterface
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Config\Model\ResourceModel\Config\Data\CollectionFactory
|
||||
*/
|
||||
private $configDataCollectionFactory;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\App\Config\Storage\WriterInterface
|
||||
*/
|
||||
private $configWriter;
|
||||
|
||||
/**
|
||||
* @param \Magento\Config\Model\ResourceModel\Config\Data\CollectionFactory $configDataCollectionFactory
|
||||
* @param \Magento\Framework\App\Config\Storage\WriterInterface $configWriter
|
||||
*/
|
||||
public function __construct(
|
||||
CollectionFactory $configDataCollectionFactory,
|
||||
WriterInterface $configWriter
|
||||
) {
|
||||
$this->configDataCollectionFactory = $configDataCollectionFactory;
|
||||
$this->configWriter = $configWriter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function apply()
|
||||
{
|
||||
/** @var \Magento\Config\Model\ResourceModel\Config\Data\Collection $configDataCollection */
|
||||
$configDataCollection = $this->configDataCollectionFactory->create();
|
||||
$configDataCollection->addFieldToFilter('path', Config::XML_PATH_GTM_CONTAINER_ID);
|
||||
$isGtmAlreadyEnabled = $configDataCollection->getSize();
|
||||
|
||||
if ($isGtmAlreadyEnabled) {
|
||||
$this->configWriter->save(Config::XML_PATH_GTM_CONSENT_MODE_ENABLED, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function getDependencies(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getAliases(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user