mirror of
https://github.com/bdnugget/magento2.git
synced 2026-11-07 09:17:35 +00:00
40 lines
1.4 KiB
PHP
40 lines
1.4 KiB
PHP
<?php
|
|
/**
|
|
* Copyright © Magento, Inc. All rights reserved.
|
|
* See COPYING.txt for license details.
|
|
*/
|
|
namespace Magento\Backend\Controller\Adminhtml\System\Design;
|
|
|
|
use Magento\Framework\App\Action\HttpPostActionInterface;
|
|
|
|
/**
|
|
* Delete store design schedule action.
|
|
*/
|
|
class Delete extends \Magento\Backend\Controller\Adminhtml\System\Design implements HttpPostActionInterface
|
|
{
|
|
/**
|
|
* Execute action.
|
|
*
|
|
* @return \Magento\Backend\Model\View\Result\Redirect
|
|
*/
|
|
public function execute()
|
|
{
|
|
$id = $this->getRequest()->getParam('id');
|
|
if ($id) {
|
|
$design = $this->_objectManager->create(\Magento\Framework\App\DesignInterface::class)->load($id);
|
|
|
|
try {
|
|
$design->delete();
|
|
$this->messageManager->addSuccessMessage(__('You deleted the design change.'));
|
|
} catch (\Magento\Framework\Exception\LocalizedException $e) {
|
|
$this->messageManager->addErrorMessage($e->getMessage());
|
|
} catch (\Exception $e) {
|
|
$this->messageManager->addExceptionMessage($e, __("You can't delete the design change."));
|
|
}
|
|
}
|
|
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
|
|
$resultRedirect = $this->resultRedirectFactory->create();
|
|
return $resultRedirect->setPath('adminhtml/*/');
|
|
}
|
|
}
|