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  $variable = $this->_initVariable();
20  $resultRedirect = $this->resultRedirectFactory->create();
21  if ($variable->getId()) {
22  try {
23  $variable->delete();
24  $this->messageManager->addSuccess(__('You deleted the custom variable.'));
25  } catch (\Exception $e) {
26  $this->messageManager->addError($e->getMessage());
27  return $resultRedirect->setPath('adminhtml/*/edit', ['_current' => true]);
28  }
29  }
30  return $resultRedirect->setPath('adminhtml/*/');
31  }
32 }
__()
Definition: __.php:13
$variable
Definition: variable.php:7