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-store
Model
StoreScopeProvider.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Store\Model
;
8
9
use
Magento\Framework\Model\Entity\ScopeProviderInterface
;
10
use
Magento\Store\Model\Store
;
11
use
Magento\Framework\Model\Entity\ScopeFactory
;
12
16
class
StoreScopeProvider
implements
ScopeProviderInterface
17
{
21
private
$storeManager;
22
26
private
$scopeFactory;
27
34
public
function
__construct
(
35
StoreManagerInterface
$storeManager,
36
ScopeFactory
$scopeFactory
37
) {
38
$this->storeManager =
$storeManager
;
39
$this->scopeFactory = $scopeFactory;
40
}
41
48
public
function
getContext
(
$entityType
, $entityData = [])
49
{
50
if
(isset($entityData[
Store::STORE_ID
])) {
51
$value
= $entityData[
Store::STORE_ID
];
52
}
else
{
53
$value
= (int)$this->storeManager->getStore(
true
)->getId();
54
}
55
56
$identifier =
Store::STORE_ID
;
57
$fallback =
null
;
58
if
(
$value
!=
Store::DEFAULT_STORE_ID
) {
59
$fallback = $this->scopeFactory->create($identifier,
Store::DEFAULT_STORE_ID
);
60
}
61
return
$this->scopeFactory->create($identifier,
$value
, $fallback);
62
}
63
}
Magento\Store\Model\Store\DEFAULT_STORE_ID
const DEFAULT_STORE_ID
Definition:
Store.php:124
Magento\Store\Model\StoreScopeProvider
Definition:
StoreScopeProvider.php:16
Magento\Framework\Model\Entity\ScopeProviderInterface
Definition:
ScopeProviderInterface.php:12
$storeManager
$storeManager
Definition:
paypal_quote.php:14
$entityType
$entityType
Definition:
attribute_set_with_image_attribute.php:13
Magento\Framework\Model\Entity\ScopeFactory
Definition:
ScopeFactory.php:14
Magento\Store\Model\Store\STORE_ID
const STORE_ID
Definition:
Store.php:47
Magento\Store\Model
Magento\Store\Model\StoreManagerInterface
Definition:
StoreManagerInterface.php:17
$value
$value
Definition:
gender.phtml:16
Magento\Store\Model\StoreScopeProvider\__construct
__construct(StoreManagerInterface $storeManager, ScopeFactory $scopeFactory)
Definition:
StoreScopeProvider.php:34
Magento\Store\Model\StoreScopeProvider\getContext
getContext($entityType, $entityData=[])
Definition:
StoreScopeProvider.php:48
Magento\Store\Model\Store
Definition:
Store.php:38