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-analytics
Model
Config
Backend
Enabled.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Analytics\Model\Config\Backend
;
7
8
use
Magento\Analytics\Model\Config\Backend\Enabled\SubscriptionHandler
;
9
use
Magento\Framework\App\Cache\TypeListInterface
;
10
use
Magento\Framework\App\Config\ScopeConfigInterface
;
11
use
Magento\Framework\App\Config\Value
;
12
use
Magento\Framework\Data\Collection\AbstractDb
;
13
use
Magento\Framework\Exception\LocalizedException
;
14
use
Magento\Framework\Model\Context
;
15
use
Magento\Framework\Model\ResourceModel\AbstractResource
;
16
use
Magento\Framework\Registry
;
17
21
class
Enabled
extends
Value
22
{
26
const
XML_ENABLED_CONFIG_STRUCTURE_PATH
=
'analytics/general/enabled'
;
27
33
private
$subscriptionHandler;
34
45
public
function
__construct
(
46
Context
$context,
47
Registry
$registry
,
48
ScopeConfigInterface
$config
,
49
TypeListInterface
$cacheTypeList
,
50
SubscriptionHandler
$subscriptionHandler,
51
AbstractResource
$resource
=
null
,
52
AbstractDb
$resourceCollection =
null
,
53
array $data = []
54
) {
55
$this->subscriptionHandler = $subscriptionHandler;
56
parent::__construct($context,
$registry
,
$config
,
$cacheTypeList
,
$resource
, $resourceCollection,
$data
);
57
}
58
65
public
function
afterSave
()
66
{
67
try
{
68
if
($this->
isValueChanged
()) {
69
$enabled = $this->
getData
(
'value'
);
70
$enabled ? $this->subscriptionHandler->processEnabled() : $this->subscriptionHandler->processDisabled();
71
}
72
}
catch
(\Exception $e) {
73
$this->_logger->error($e->getMessage());
74
throw
new
LocalizedException
(
__
(
'There was an error save new configuration value.'
));
75
}
76
77
return
parent::afterSave();
78
}
79
}
Magento\Framework\App\Config\Value
Definition:
Value.php:28
Magento\Framework\Exception\LocalizedException
Definition:
LocalizedException.php:17
Magento\Framework\App\Config\Value\isValueChanged
isValueChanged()
Definition:
Value.php:84
Magento\Analytics\Model\Config\Backend\Enabled\SubscriptionHandler
Definition:
SubscriptionHandler.php:17
Magento\Framework\DataObject\getData
getData($key='', $index=null)
Definition:
DataObject.php:119
$config
$config
Definition:
fraud_order.php:17
Magento\Analytics\Model\Config\Backend\Enabled
Definition:
Enabled.php:21
__
__()
Definition:
__.php:13
$resource
$resource
Definition:
bulk.php:12
Magento\Analytics\Model\Config\Backend
Magento\Framework\Model\Context
Definition:
Context.php:24
Magento\Framework\Data\Collection\AbstractDb
Definition:
AbstractDb.php:23
$registry
$registry
Definition:
bundle_product_with_not_visible_children_rollback.php:16
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\Analytics\Model\Config\Backend\Enabled\XML_ENABLED_CONFIG_STRUCTURE_PATH
const XML_ENABLED_CONFIG_STRUCTURE_PATH
Definition:
Enabled.php:26
Magento\Framework\App\Cache\TypeListInterface
Definition:
TypeListInterface.php:12
Magento\Analytics\Model\Config\Backend\Enabled\__construct
__construct(Context $context, Registry $registry, ScopeConfigInterface $config, TypeListInterface $cacheTypeList, SubscriptionHandler $subscriptionHandler, AbstractResource $resource=null, AbstractDb $resourceCollection=null, array $data=[])
Definition:
Enabled.php:45
Magento\Framework\Registry
Definition:
Registry.php:18
Magento\Analytics\Model\Config\Backend\Enabled\afterSave
afterSave()
Definition:
Enabled.php:65
Magento\Framework\Model\ResourceModel\AbstractResource
Definition:
AbstractResource.php:19
Magento\Framework\App\Config\ScopeConfigInterface
Definition:
ScopeConfigInterface.php:15
Magento\Framework\App\Config\Value\$cacheTypeList
$cacheTypeList
Definition:
Value.php:54