ltsecurityinc安防产品在线商城代码
This commit is contained in:
+50
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Plumrocket Inc.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the End-user License Agreement
|
||||
* that is available through the world-wide-web at this URL:
|
||||
* http://wiki.plumrocket.net/wiki/EULA
|
||||
* If you are unable to obtain it through the world-wide-web, please
|
||||
* send an email to support@plumrocket.com so we can send you a copy immediately.
|
||||
*
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
|
||||
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\CookieConsent\Block\Adminhtml\Cookie\Category\Edit\Button;
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Back extends Generic
|
||||
{
|
||||
/**
|
||||
* Get Button Data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getButtonData(): array
|
||||
{
|
||||
return [
|
||||
'label' => __('Back'),
|
||||
'on_click' => sprintf("location.href = '%s';", $this->getBackUrl()),
|
||||
'class' => 'back',
|
||||
'sort_order' => 10
|
||||
];
|
||||
}
|
||||
/**
|
||||
* Get URL for back
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getBackUrl(): string
|
||||
{
|
||||
return $this->getUrl('*/*/');
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Plumrocket Inc.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the End-user License Agreement
|
||||
* that is available through the world-wide-web at this URL:
|
||||
* http://wiki.plumrocket.net/wiki/EULA
|
||||
* If you are unable to obtain it through the world-wide-web, please
|
||||
* send an email to support@plumrocket.com so we can send you a copy immediately.
|
||||
*
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
|
||||
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\CookieConsent\Block\Adminhtml\Cookie\Category\Edit\Button;
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Delete extends Generic
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getButtonData()
|
||||
{
|
||||
$data = [];
|
||||
if ($this->getCategory()->getId()) {
|
||||
$data = [
|
||||
'label' => __('Delete'),
|
||||
'class' => 'delete',
|
||||
'on_click' => 'deleteConfirm(\'' . __('Are you sure you want to do this?')
|
||||
. '\', \'' . $this->getDeleteUrl() . '\', {"data": {}})',
|
||||
'sort_order' => 20,
|
||||
];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get URL for delete
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getDeleteUrl(): string
|
||||
{
|
||||
return $this->getUrl('*/*/delete', ['id' => $this->getCategory()->getId()]);
|
||||
}
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* Plumrocket Inc.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the End-user License Agreement
|
||||
* that is available through the world-wide-web at this URL:
|
||||
* http://wiki.plumrocket.net/wiki/EULA
|
||||
* If you are unable to obtain it through the world-wide-web, please
|
||||
* send an email to support@plumrocket.com so we can send you a copy immediately.
|
||||
*
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
|
||||
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\CookieConsent\Block\Adminhtml\Cookie\Category\Edit\Button;
|
||||
|
||||
use Magento\Framework\View\Element\UiComponent\Context;
|
||||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
|
||||
use Plumrocket\CookieConsent\Api\Data\CategoryInterface;
|
||||
use Plumrocket\CookieConsent\Ui\Locator\CategoryLocatorInterface;
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Generic implements ButtonProviderInterface
|
||||
{
|
||||
/**
|
||||
* Url Builder
|
||||
*
|
||||
* @var Context
|
||||
*/
|
||||
protected $context;
|
||||
|
||||
/**
|
||||
* @var \Plumrocket\CookieConsent\Ui\Locator\CategoryLocatorInterface
|
||||
*/
|
||||
private $categoryLocator;
|
||||
|
||||
/**
|
||||
* Generic constructor
|
||||
*
|
||||
* @param Context $context
|
||||
* @param \Plumrocket\CookieConsent\Ui\Locator\CategoryLocatorInterface $categoryLocator
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
CategoryLocatorInterface $categoryLocator
|
||||
) {
|
||||
$this->context = $context;
|
||||
$this->categoryLocator = $categoryLocator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate url by route and parameters
|
||||
*
|
||||
* @param string $route
|
||||
* @param array $params
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl($route = '', $params = [])
|
||||
{
|
||||
return $this->context->getUrl($route, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Plumrocket\CookieConsent\Api\Data\CategoryInterface
|
||||
* @throws \Magento\Framework\Exception\NotFoundException
|
||||
*/
|
||||
public function getCategory(): CategoryInterface
|
||||
{
|
||||
return $this->categoryLocator->getCategory();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getButtonData()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* Plumrocket Inc.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the End-user License Agreement
|
||||
* that is available through the world-wide-web at this URL:
|
||||
* http://wiki.plumrocket.net/wiki/EULA
|
||||
* If you are unable to obtain it through the world-wide-web, please
|
||||
* send an email to support@plumrocket.com so we can send you a copy immediately.
|
||||
*
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
|
||||
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\CookieConsent\Block\Adminhtml\Cookie\Category\Edit\Button;
|
||||
|
||||
use Magento\Ui\Component\Control\Container;
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Save extends Generic
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getButtonData(): array
|
||||
{
|
||||
return [
|
||||
'label' => __('Save'),
|
||||
'class' => 'save primary',
|
||||
'data_attribute' => [
|
||||
'mage-init' => [
|
||||
'buttonAdapter' => [
|
||||
'actions' => [
|
||||
[
|
||||
'targetName' => 'pr_cookie_category_form.pr_cookie_category_form',
|
||||
'actionName' => 'save',
|
||||
'params' => [
|
||||
false
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
'class_name' => Container::SPLIT_BUTTON,
|
||||
'options' => $this->getOptions(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions(): array
|
||||
{
|
||||
$options[] = [
|
||||
'id_hard' => 'save_and_close',
|
||||
'label' => __('Save & Close'),
|
||||
'data_attribute' => [
|
||||
'mage-init' => [
|
||||
'buttonAdapter' => [
|
||||
'actions' => [
|
||||
[
|
||||
'targetName' => 'pr_cookie_category_form.pr_cookie_category_form',
|
||||
'actionName' => 'save',
|
||||
'params' => [
|
||||
true
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Plumrocket Inc.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the End-user License Agreement
|
||||
* that is available through the world-wide-web at this URL:
|
||||
* http://wiki.plumrocket.net/wiki/EULA
|
||||
* If you are unable to obtain it through the world-wide-web, please
|
||||
* send an email to support@plumrocket.com so we can send you a copy immediately.
|
||||
*
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
|
||||
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\CookieConsent\Block\Adminhtml\Cookie\Item\Edit\Button;
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Back extends Generic
|
||||
{
|
||||
/**
|
||||
* Get Button Data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getButtonData(): array
|
||||
{
|
||||
return [
|
||||
'label' => __('Back'),
|
||||
'on_click' => sprintf("location.href = '%s';", $this->getBackUrl()),
|
||||
'class' => 'back',
|
||||
'sort_order' => 10
|
||||
];
|
||||
}
|
||||
/**
|
||||
* Get URL for back
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getBackUrl(): string
|
||||
{
|
||||
return $this->getUrl('*/*/');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Plumrocket Inc.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the End-user License Agreement
|
||||
* that is available through the world-wide-web at this URL:
|
||||
* http://wiki.plumrocket.net/wiki/EULA
|
||||
* If you are unable to obtain it through the world-wide-web, please
|
||||
* send an email to support@plumrocket.com so we can send you a copy immediately.
|
||||
*
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
|
||||
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\CookieConsent\Block\Adminhtml\Cookie\Item\Edit\Button;
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Delete extends Generic
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getButtonData()
|
||||
{
|
||||
$data = [];
|
||||
if ($this->getCookie()->getId()) {
|
||||
$data = [
|
||||
'label' => __('Delete'),
|
||||
'class' => 'delete',
|
||||
'on_click' => 'deleteConfirm(\'' . __('Are you sure you want to do this?')
|
||||
. '\', \'' . $this->getDeleteUrl() . '\', {"data": {}})',
|
||||
'sort_order' => 20,
|
||||
];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get URL for delete
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getDeleteUrl(): string
|
||||
{
|
||||
return $this->getUrl('*/*/delete', ['id' => $this->getCookie()->getId()]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* Plumrocket Inc.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the End-user License Agreement
|
||||
* that is available through the world-wide-web at this URL:
|
||||
* http://wiki.plumrocket.net/wiki/EULA
|
||||
* If you are unable to obtain it through the world-wide-web, please
|
||||
* send an email to support@plumrocket.com so we can send you a copy immediately.
|
||||
*
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
|
||||
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\CookieConsent\Block\Adminhtml\Cookie\Item\Edit\Button;
|
||||
|
||||
use Magento\Framework\View\Element\UiComponent\Context;
|
||||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
|
||||
use Plumrocket\CookieConsent\Api\Data\CookieInterface;
|
||||
use Plumrocket\CookieConsent\Ui\Locator\CookieLocatorInterface;
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Generic implements ButtonProviderInterface
|
||||
{
|
||||
/**W
|
||||
* Url Builder
|
||||
*
|
||||
* @var Context
|
||||
*/
|
||||
protected $context;
|
||||
|
||||
/**
|
||||
* @var \Plumrocket\CookieConsent\Ui\Locator\CookieLocatorInterface
|
||||
*/
|
||||
private $cookieLocator;
|
||||
|
||||
/**
|
||||
* Generic constructor
|
||||
*
|
||||
* @param Context $context
|
||||
* @param \Plumrocket\CookieConsent\Ui\Locator\CookieLocatorInterface $cookieLocator
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
CookieLocatorInterface $cookieLocator
|
||||
) {
|
||||
$this->context = $context;
|
||||
$this->cookieLocator = $cookieLocator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate url by route and parameters
|
||||
*
|
||||
* @param string $route
|
||||
* @param array $params
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl($route = '', $params = [])
|
||||
{
|
||||
return $this->context->getUrl($route, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Plumrocket\CookieConsent\Api\Data\CookieInterface
|
||||
* @throws \Magento\Framework\Exception\NotFoundException
|
||||
*/
|
||||
public function getCookie(): CookieInterface
|
||||
{
|
||||
return $this->cookieLocator->getCookie();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getButtonData()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* Plumrocket Inc.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the End-user License Agreement
|
||||
* that is available through the world-wide-web at this URL:
|
||||
* http://wiki.plumrocket.net/wiki/EULA
|
||||
* If you are unable to obtain it through the world-wide-web, please
|
||||
* send an email to support@plumrocket.com so we can send you a copy immediately.
|
||||
*
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
|
||||
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\CookieConsent\Block\Adminhtml\Cookie\Item\Edit\Button;
|
||||
|
||||
use Magento\Ui\Component\Control\Container;
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Save extends Generic
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getButtonData(): array
|
||||
{
|
||||
return [
|
||||
'label' => __('Save'),
|
||||
'class' => 'save primary',
|
||||
'data_attribute' => [
|
||||
'mage-init' => [
|
||||
'buttonAdapter' => [
|
||||
'actions' => [
|
||||
[
|
||||
'targetName' => 'pr_cookie_item_form.pr_cookie_item_form',
|
||||
'actionName' => 'save',
|
||||
'params' => [
|
||||
false
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
'class_name' => Container::SPLIT_BUTTON,
|
||||
'options' => $this->getOptions(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions(): array
|
||||
{
|
||||
$options[] = [
|
||||
'id_hard' => 'save_and_close',
|
||||
'label' => __('Save & Close'),
|
||||
'data_attribute' => [
|
||||
'mage-init' => [
|
||||
'buttonAdapter' => [
|
||||
'actions' => [
|
||||
[
|
||||
'targetName' => 'pr_cookie_item_form.pr_cookie_item_form',
|
||||
'actionName' => 'save',
|
||||
'params' => [
|
||||
true
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2025 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\CookieConsent\Block\Adminhtml\System\Config\Form\ConsentTypes;
|
||||
|
||||
use Magento\Framework\View\Element\Context;
|
||||
use Magento\Framework\View\Element\Html\Select;
|
||||
use Plumrocket\CookieConsent\Model\Cookie\Attribute\Source\CategoryKey;
|
||||
|
||||
/**
|
||||
* @since 2.0.5
|
||||
*/
|
||||
class CookieCategorySelect extends Select
|
||||
{
|
||||
/**
|
||||
* @var \Plumrocket\CookieConsent\Model\Cookie\Attribute\Source\CategoryKey
|
||||
*/
|
||||
private $cookieCategory;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\View\Element\Context $context
|
||||
* @param \Plumrocket\CookieConsent\Model\Cookie\Attribute\Source\CategoryKey $cookieCategory
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
CategoryKey $cookieCategory,
|
||||
array $data = []
|
||||
) {
|
||||
$this->cookieCategory = $cookieCategory;
|
||||
parent::__construct($context, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set "name" for <select> element
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function setInputName($value)
|
||||
{
|
||||
return $this->setName($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set "id" for <select> element
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function setInputId($value)
|
||||
{
|
||||
return $this->setId($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render block HTML
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function _toHtml(): string
|
||||
{
|
||||
if (!$this->getOptions()) {
|
||||
$this->setOptions($this->getSourceOptions());
|
||||
}
|
||||
|
||||
return parent::_toHtml();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve cookie category options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getSourceOptions(): array
|
||||
{
|
||||
return $this->cookieCategory->getAllOptions();
|
||||
}
|
||||
}
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2025 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\CookieConsent\Block\Adminhtml\System\Config\Form\ConsentTypes;
|
||||
|
||||
use Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray;
|
||||
use Magento\Framework\DataObject;
|
||||
use Magento\Framework\Exception\LocalizedException;
|
||||
|
||||
/**
|
||||
* @since 2.0.5
|
||||
*/
|
||||
class MappingTable extends AbstractFieldArray
|
||||
{
|
||||
/**
|
||||
* @var \Plumrocket\CookieConsent\Block\Adminhtml\System\Config\Form\ConsentTypes\StatusSelect|null
|
||||
*/
|
||||
private $statusRenderer;
|
||||
|
||||
/**
|
||||
* @var \Plumrocket\CookieConsent\Block\Adminhtml\System\Config\Form\ConsentTypes\CookieCategorySelect|null
|
||||
*/
|
||||
private $cookieCategoryRender;
|
||||
|
||||
/**
|
||||
* Prepare rendering the new field by adding all the needed columns
|
||||
*/
|
||||
protected function _prepareToRender(): void
|
||||
{
|
||||
$this->addColumn('consent_type', ['label' => __('Consent Type'), 'class' => 'required-entry']);
|
||||
$this->addColumn('status', ['label' => __('Default Status'), 'renderer' => $this->getStatusRenderer()]);
|
||||
$this->addColumn(
|
||||
'cookie_category',
|
||||
['label' => __('Cookie Category'), 'renderer' => $this->getCookieCategoryRenderer()]
|
||||
);
|
||||
$this->_addAfter = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function renderCellTemplate($columnName)
|
||||
{
|
||||
$html = parent::renderCellTemplate($columnName);
|
||||
|
||||
if ($columnName === 'consent_type') {
|
||||
$doc = new \DOMDocument();
|
||||
$doc->loadHTML($html);
|
||||
$input = $doc->getElementsByTagName('input')[0];
|
||||
$input->setAttribute('readonly', '');
|
||||
$html = $doc->saveHTML($input);
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare existing row data object
|
||||
*
|
||||
* @param DataObject $row
|
||||
* @throws LocalizedException
|
||||
*/
|
||||
protected function _prepareArrayRow(DataObject $row): void
|
||||
{
|
||||
$options = [];
|
||||
|
||||
$status = $row->getStatus();
|
||||
if ($status !== null) {
|
||||
$options['option_' . $this->getStatusRenderer()->calcOptionHash($status)] = 'selected="selected"';
|
||||
}
|
||||
|
||||
$cookieCategory = $row->getCookieCategory();
|
||||
if ($cookieCategory !== null) {
|
||||
$optionHash = $this->getCookieCategoryRenderer()->calcOptionHash($cookieCategory);
|
||||
$options['option_' . $optionHash] = 'selected="selected"';
|
||||
}
|
||||
|
||||
$row->setData('option_extra_attrs', $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function _toHtml(): string
|
||||
{
|
||||
$html = parent::_toHtml();
|
||||
$style = $this->getStyle();
|
||||
|
||||
return $html . $style;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve css styles
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getStyle(): string
|
||||
{
|
||||
$htmlId = '#' . $this->_escaper->escapeHtml($this->getElement()->getId());
|
||||
|
||||
return "<style>
|
||||
$htmlId tfoot, .col-actions {display: none;}
|
||||
</style>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve status column renderer
|
||||
*
|
||||
* @return \Plumrocket\CookieConsent\Block\Adminhtml\System\Config\Form\ConsentTypes\StatusSelect
|
||||
*/
|
||||
private function getStatusRenderer(): StatusSelect
|
||||
{
|
||||
if (! $this->statusRenderer) {
|
||||
$this->statusRenderer = $this->getLayout()
|
||||
->createBlock(
|
||||
StatusSelect::class,
|
||||
'',
|
||||
['data' => ['is_render_to_js_template' => true]]
|
||||
);
|
||||
}
|
||||
|
||||
return $this->statusRenderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve cookie_category column renderer
|
||||
*
|
||||
* @return \Plumrocket\CookieConsent\Block\Adminhtml\System\Config\Form\ConsentTypes\CookieCategorySelect
|
||||
*/
|
||||
private function getCookieCategoryRenderer(): CookieCategorySelect
|
||||
{
|
||||
if (!$this->cookieCategoryRender) {
|
||||
$this->cookieCategoryRender = $this->getLayout()
|
||||
->createBlock(
|
||||
CookieCategorySelect::class,
|
||||
'',
|
||||
['data' => ['is_render_to_js_template' => true]]
|
||||
);
|
||||
}
|
||||
|
||||
return $this->cookieCategoryRender;
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2025 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\CookieConsent\Block\Adminhtml\System\Config\Form\ConsentTypes;
|
||||
|
||||
use Magento\Framework\View\Element\Html\Select;
|
||||
|
||||
/**
|
||||
* @since 2.0.5
|
||||
*/
|
||||
class StatusSelect extends Select
|
||||
{
|
||||
/**
|
||||
* Set "name" for <select> element
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function setInputName($value)
|
||||
{
|
||||
return $this->setName($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set "id" for <select> element
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function setInputId($value)
|
||||
{
|
||||
return $this->setId($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render block HTML
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function _toHtml(): string
|
||||
{
|
||||
if (!$this->getOptions()) {
|
||||
$this->setOptions($this->getSourceOptions());
|
||||
}
|
||||
|
||||
return parent::_toHtml();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve status options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getSourceOptions(): array
|
||||
{
|
||||
return [
|
||||
['label' => __('Granted'), 'value' => 'granted'],
|
||||
['label' => __('Denied'), 'value' => 'denied'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* Plumrocket Inc.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the End-user License Agreement
|
||||
* that is available through the world-wide-web at this URL:
|
||||
* http://wiki.plumrocket.net/wiki/EULA
|
||||
* If you are unable to obtain it through the world-wide-web, please
|
||||
* send an email to support@plumrocket.com so we can send you a copy immediately.
|
||||
*
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
|
||||
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
|
||||
*/
|
||||
|
||||
namespace Plumrocket\CookieConsent\Block\Adminhtml\System\Config\Form;
|
||||
|
||||
use Magento\Backend\Block\Template\Context;
|
||||
use Magento\Config\Block\System\Config\Form\Field;
|
||||
use Magento\Framework\App\RequestInterface;
|
||||
use Magento\Framework\Data\Form\Element\AbstractElement;
|
||||
|
||||
class Cookie extends Field
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Framework\App\Request\Http
|
||||
*/
|
||||
private $request;
|
||||
|
||||
/**
|
||||
* Cookie constructor.
|
||||
*
|
||||
* @param \Magento\Backend\Block\Template\Context $context
|
||||
* @param \Magento\Framework\App\RequestInterface $request
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
RequestInterface $request,
|
||||
array $data = []
|
||||
) {
|
||||
$this->request = $request;
|
||||
parent::__construct($context, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve element HTML markup
|
||||
* Argument $element must be specified
|
||||
* We need to extend parent method
|
||||
*
|
||||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
|
||||
* @return string
|
||||
*/
|
||||
protected function _getElementHtml(AbstractElement $element)
|
||||
{
|
||||
$params = [];
|
||||
$websiteId = (int) $this->request->getParam('website', 0);
|
||||
$storeId = (int) $this->request->getParam('store', 0);
|
||||
|
||||
if ($websiteId) {
|
||||
$params['website'] = $websiteId;
|
||||
}
|
||||
|
||||
if ($storeId) {
|
||||
$params['store'] = $storeId;
|
||||
}
|
||||
|
||||
$url = $this->_urlBuilder->getUrl('adminhtml/system_config/edit/section/web', $params);
|
||||
|
||||
return __(
|
||||
'To Enable, <a href="%1" target="_blank">Click here</a>, then open "Default Cookie Settings" section and' .
|
||||
' set "Yes" next to the "Cookie Restriction Mode". Then save changes.',
|
||||
$url
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render inheritance checkbox (Use Default or Use Website)
|
||||
* Argument $element must be specified
|
||||
* We need to extend parent method
|
||||
*
|
||||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
|
||||
* @return string
|
||||
*/
|
||||
protected function _renderInheritCheckbox(AbstractElement $element)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
<?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\Block\Adminhtml\System\Config\Form;
|
||||
|
||||
use Plumrocket\CookieConsent\Block\Adminhtml\System\Config\Form\ConsentTypes\MappingTable;
|
||||
|
||||
/**
|
||||
* @since 1.5.0
|
||||
* @deprecated since 2.0.5
|
||||
* @see \Plumrocket\CookieConsent\Block\Adminhtml\System\Config\Form\ConsentTypes\MappingTable
|
||||
*/
|
||||
class GtmConsentMode extends MappingTable
|
||||
{
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
<?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\Block\Adminhtml\System\Config\Form;
|
||||
|
||||
use Plumrocket\CookieConsent\Block\Adminhtml\System\Config\Form\ConsentTypes\CookieCategorySelect;
|
||||
|
||||
/**
|
||||
* @since 1.5.0
|
||||
* @deprecated since 2.0.5
|
||||
* @see \Plumrocket\CookieConsent\Block\Adminhtml\System\Config\Form\ConsentTypes\CookieCategorySelect
|
||||
*/
|
||||
class GtmConsentModeCookieCategory extends CookieCategorySelect
|
||||
{
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
<?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\Block\Adminhtml\System\Config\Form;
|
||||
|
||||
use Plumrocket\CookieConsent\Block\Adminhtml\System\Config\Form\ConsentTypes\StatusSelect;
|
||||
|
||||
/**
|
||||
* @since 1.5.0
|
||||
* @deprecated since 2.0.5
|
||||
* @see \Plumrocket\CookieConsent\Block\Adminhtml\System\Config\Form\ConsentTypes\StatusSelect
|
||||
*/
|
||||
class GtmConsentModeStatus extends StatusSelect
|
||||
{
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2025 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\CookieConsent\Block\Adminhtml\System\Config\Form;
|
||||
|
||||
use Magento\Config\Block\System\Config\Form\Field;
|
||||
use Magento\Framework\Data\Form\Element\AbstractElement;
|
||||
|
||||
class UpgradeToProVersionNotice extends Field
|
||||
{
|
||||
protected $_template = 'Plumrocket_CookieConsent::system/config/upgrade_to_pro_version_notice.phtml';
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Data\Form\Element\AbstractElement
|
||||
*/
|
||||
private $element;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
|
||||
* @return string
|
||||
*/
|
||||
public function render(AbstractElement $element): string
|
||||
{
|
||||
$this->setData('notice_intro', $element->getData('field_config/notice_intro'));
|
||||
$html = <<<HTML
|
||||
<td class="pr-cookie value pr-notice__content-wrapper" colspan="3">
|
||||
<div class="pr-notice__content">
|
||||
{$this->_getElementHtml($element)}
|
||||
</div>
|
||||
</td>
|
||||
HTML;
|
||||
return $this->_decorateRowHtml($element, $html);
|
||||
}
|
||||
|
||||
protected function _getElementHtml(AbstractElement $element): string
|
||||
{
|
||||
return $this->_toHtml();
|
||||
}
|
||||
|
||||
/**
|
||||
* Decorate field row html
|
||||
*
|
||||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
|
||||
* @param string $html
|
||||
* @return string
|
||||
*/
|
||||
protected function _decorateRowHtml(AbstractElement $element, $html): string
|
||||
{
|
||||
return <<<HTML
|
||||
<tr id="row_{$element->getHtmlId()}" class="pr_notice pr_notice--note upgrade-to-pro pr-notice--full-width">
|
||||
{$html}
|
||||
</tr>
|
||||
HTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getNoticeIntro(): string
|
||||
{
|
||||
return $this->getData('notice_intro');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Plumrocket Inc.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the End-user License Agreement
|
||||
* that is available through the world-wide-web at this URL:
|
||||
* http://wiki.plumrocket.net/wiki/EULA
|
||||
* If you are unable to obtain it through the world-wide-web, please
|
||||
* send an email to support@plumrocket.com so we can send you a copy immediately.
|
||||
*
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2021 Plumrocket Inc. (http://www.plumrocket.com)
|
||||
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\CookieConsent\Block\Adminhtml\System\Config\Form;
|
||||
|
||||
use Magento\Config\Block\System\Config\Form\Field;
|
||||
use Magento\Framework\Data\Form\Element\AbstractElement;
|
||||
|
||||
/**
|
||||
* @since 1.2.0
|
||||
*/
|
||||
class WidgetCode extends Field
|
||||
{
|
||||
/**
|
||||
* Make this field readonly
|
||||
*
|
||||
* Do it here because no possibility via system.xml
|
||||
*
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function _getElementHtml(AbstractElement $element)
|
||||
{
|
||||
$element->setReadonly(true);
|
||||
return parent::_getElementHtml($element);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user