Files

60 lines
1.9 KiB
PHP

<?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\Controller\Adminhtml\Item;
use Magento\Backend\App\Action\Context;
use Magento\Framework\App\Request\DataPersistorInterface;
use Magento\Framework\Controller\ResultFactory;
use Plumrocket\CookieConsent\Api\Data\CookieInterface;
use Plumrocket\CookieConsent\Controller\Adminhtml\AbstractItem;
/**
* @since 1.0.0
*/
class Index extends AbstractItem
{
/**
* @var \Magento\Framework\App\Request\DataPersistorInterface
*/
private $dataPersistor;
/**
* Index constructor.
*
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\App\Request\DataPersistorInterface $dataPersistor
*/
public function __construct(
Context $context,
DataPersistorInterface $dataPersistor
) {
parent::__construct($context);
$this->dataPersistor = $dataPersistor;
}
public function execute()
{
/** @var \Magento\Backend\Model\View\Result\Page $resultPage */
$resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
$this->initBreadcrumbAndMenu($resultPage)->getConfig()->getTitle()->prepend(__('Manage Cookies'));
$this->dataPersistor->clear(CookieInterface::DATA_PERSISTOR_KEY);
return $resultPage;
}
}