| Current Path : /home/rtorresani/www/vendor/magento/module-backend/Controller/Adminhtml/System/Design/ |
| Current File : //home/rtorresani/www/vendor/magento/module-backend/Controller/Adminhtml/System/Design/Delete.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/*/');
}
}