Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Loader.php
Go to the documentation of this file.
1 <?php
11 
19 class Loader
20 {
27 
31  public function __construct(\Magento\Framework\App\Config\ValueFactory $configValueFactory)
32  {
33  $this->_configValueFactory = $configValueFactory;
34  }
35 
45  public function getConfigByPath($path, $scope, $scopeId, $full = true)
46  {
47  $configDataCollection = $this->_configValueFactory->create();
48  $configDataCollection = $configDataCollection->getCollection()->addScopeFilter($scope, $scopeId, $path);
49 
50  $config = [];
51  $configDataCollection->load();
52  foreach ($configDataCollection->getItems() as $data) {
53  if ($full) {
54  $config[$data->getPath()] = [
55  'path' => $data->getPath(),
56  'value' => $data->getValue(),
57  'config_id' => $data->getConfigId(),
58  ];
59  } else {
60  $config[$data->getPath()] = $data->getValue();
61  }
62  }
63  return $config;
64  }
65 }
__construct(\Magento\Framework\App\Config\ValueFactory $configValueFactory)
Definition: Loader.php:31
$config
Definition: fraud_order.php:17
getConfigByPath($path, $scope, $scopeId, $full=true)
Definition: Loader.php:45