Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-variable
Controller
Adminhtml
System
Variable
Save.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Variable\Controller\Adminhtml\System\Variable
;
8
15
class
Save
extends
\Magento\Variable\Controller\Adminhtml\System\Variable
16
{
22
public
function
execute
()
23
{
24
$variable
= $this->
_initVariable
();
25
$data
= $this->
getRequest
()->getPost(
'variable'
);
26
$back = $this->
getRequest
()->getParam(
'back'
,
false
);
28
$resultRedirect = $this->resultRedirectFactory->create();
29
if
(
$data
) {
30
$data
[
'variable_id'
] =
$variable
->getId();
31
$variable
->setData(
$data
);
32
try
{
33
$variable
->save();
34
$this->messageManager->addSuccess(
__
(
'You saved the custom variable.'
));
35
if
($back) {
36
$resultRedirect->setPath(
37
'adminhtml/*/edit'
,
38
[
'_current'
=>
true
,
'variable_id'
=>
$variable
->getId()]
39
);
40
}
else
{
41
$resultRedirect->setPath(
'adminhtml/*/'
);
42
}
43
return
$resultRedirect;
44
}
catch
(\Exception $e) {
45
$this->messageManager->addError($e->getMessage());
46
return
$resultRedirect->setPath(
'adminhtml/*/edit'
, [
'_current'
=>
true
]);
47
}
48
}
49
return
$resultRedirect->setPath(
'adminhtml/*/'
);
50
}
51
}
Magento\Variable\Controller\Adminhtml\System\Variable\_initVariable
_initVariable()
Definition:
Variable.php:92
__
__()
Definition:
__.php:13
Magento\Framework\App\Action\AbstractAction\getRequest
getRequest()
Definition:
AbstractAction.php:60
$variable
$variable
Definition:
variable.php:7
Magento\Framework\App\ActionInterface\execute
execute()
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\Variable\Controller\Adminhtml\System\Variable\Save
Definition:
Save.php:15
Magento\Variable\Controller\Adminhtml\System\Variable
Definition:
Variable.php:13
Magento\Variable\Controller\Adminhtml\System\Variable
Definition:
Delete.php:7