![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-variable/Controller/Adminhtml/System/Variable/ |
<?php /** * * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Variable\Controller\Adminhtml\System\Variable; /** * Save variable POST controller * * @api * @since 100.0.2 */ class Save extends \Magento\Variable\Controller\Adminhtml\System\Variable { /** * Save Action * * @return \Magento\Backend\Model\View\Result\Redirect */ public function execute() { $variable = $this->_initVariable(); $data = $this->getRequest()->getPost('variable'); $back = $this->getRequest()->getParam('back', false); /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultRedirectFactory->create(); if ($data) { $data['variable_id'] = $variable->getId(); $variable->setData($data); try { $variable->save(); $this->messageManager->addSuccess(__('You saved the custom variable.')); if ($back) { $resultRedirect->setPath( 'adminhtml/*/edit', ['_current' => true, 'variable_id' => $variable->getId()] ); } else { $resultRedirect->setPath('adminhtml/*/'); } return $resultRedirect; } catch (\Exception $e) { $this->messageManager->addError($e->getMessage()); return $resultRedirect->setPath('adminhtml/*/edit', ['_current' => true]); } } return $resultRedirect->setPath('adminhtml/*/'); } }