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 
10 {
16  public function execute()
17  {
18  $template = $this->_objectManager->create(
19  \Magento\Newsletter\Model\Template::class
20  )->load(
21  $this->getRequest()->getParam('id')
22  );
23  if ($template->getId()) {
24  try {
25  $template->delete();
26  $this->messageManager->addSuccess(__('The newsletter template has been deleted.'));
27  $this->_getSession()->setFormData(false);
28  } catch (\Magento\Framework\Exception\LocalizedException $e) {
29  $this->messageManager->addError($e->getMessage());
30  } catch (\Exception $e) {
31  $this->messageManager->addException($e, __('We can\'t delete this template right now.'));
32  }
33  }
34  $this->_redirect('*/template');
35  }
36 }
__()
Definition: __.php:13
$template
Definition: export.php:12