Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Delete.php
Go to the documentation of this file.
1 <?php
8 
9 class Delete extends \Magento\Backend\Controller\Adminhtml\System\Design
10 {
14  public function execute()
15  {
16  $id = $this->getRequest()->getParam('id');
17  if ($id) {
18  $design = $this->_objectManager->create(\Magento\Framework\App\DesignInterface::class)->load($id);
19 
20  try {
21  $design->delete();
22  $this->messageManager->addSuccessMessage(__('You deleted the design change.'));
23  } catch (\Magento\Framework\Exception\LocalizedException $e) {
24  $this->messageManager->addErrorMessage($e->getMessage());
25  } catch (\Exception $e) {
26  $this->messageManager->addExceptionMessage($e, __("You can't delete the design change."));
27  }
28  }
30  $resultRedirect = $this->resultRedirectFactory->create();
31  return $resultRedirect->setPath('adminhtml/*/');
32  }
33 }
$id
Definition: fieldset.phtml:14
__()
Definition: __.php:13