Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
StoresConfig.php
Go to the documentation of this file.
1 <?php
7 namespace Magento\Store\Model;
8 
10 
12 {
16  protected $_storeManager;
17 
21  protected $_config;
22 
27  public function __construct(
30  ) {
31  $this->_storeManager = $storeManager;
32  $this->_config = $config;
33  }
34 
43  public function getStoresConfigByPath($path)
44  {
45  $stores = $this->_storeManager->getStores(true);
46  $storeValues = [];
48  foreach ($stores as $store) {
49  try {
50  $value = $this->_config->getValue($path, ScopeInterface::SCOPE_STORE, $store->getCode());
51  $storeValues[$store->getId()] = $value;
52  } catch (NoSuchEntityException $e) {
53  // Store doesn't really exist, so move on.
54  continue;
55  }
56  }
57  return $storeValues;
58  }
59 }
$config
Definition: fraud_order.php:17
$storeManager
$value
Definition: gender.phtml:16
__construct(\Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\App\Config\ScopeConfigInterface $config)