Skip to content

Commit a20171a

Browse files
author
Pascal Querner
committed
feat?: backend: show data from env
1 parent 5adec77 commit a20171a

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

app/code/core/Mage/Adminhtml/Model/Config/Data.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,13 @@ protected function _getPathConfig($path, $full = true)
341341
$config[$data->getPath()] = $data->getValue();
342342
}
343343
}
344+
345+
if (!$full) {
346+
/** @var Mage_Core_Helper_EnvironmentConfigLoader $environmentConfigLoaderHelper */
347+
$environmentConfigLoaderHelper = Mage::helper('core/environmentConfigLoader');
348+
$envConfig = $environmentConfigLoaderHelper->getAsArray($scope = $this->getScope());
349+
$config = array_merge($config, $envConfig);
350+
}
344351
return $config;
345352
}
346353

app/code/core/Mage/Core/Helper/EnvironmentConfigLoader.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,42 @@ public function overrideEnvironment(Varien_Simplexml_Config $xmlConfig)
9898
}
9999
}
100100

101+
public function getAsArray(string $wantedScope): array
102+
{
103+
$env = $this->getEnv();
104+
$config = [];
105+
106+
foreach ($env as $configKey => $value) {
107+
if (!$this->isConfigKeyValid($configKey)) {
108+
continue;
109+
}
110+
111+
list($configKeyParts, $scope) = $this->getConfigKey($configKey);
112+
if (strtolower($scope) !== strtolower($wantedScope)) {
113+
continue;
114+
}
115+
116+
switch ($scope) {
117+
case static::CONFIG_KEY_DEFAULT:
118+
list($unused1, $unused2, $section, $group, $field) = $configKeyParts;
119+
$path = $this->buildPath($section, $group, $field);
120+
$config[$path] = $value;
121+
break;
122+
123+
case static::CONFIG_KEY_WEBSITES:
124+
case static::CONFIG_KEY_STORES:
125+
list($unused1, $unused2, $storeCode, $section, $group, $field) = $configKeyParts;
126+
$path = $this->buildPath($section, $group, $field);
127+
$storeCode = strtolower($storeCode);
128+
$scope = strtolower($scope);
129+
$config[$path] = $value;
130+
break;
131+
}
132+
}
133+
134+
return $config;
135+
}
136+
101137
/**
102138
* @internal method mostly for mocking
103139
*/

0 commit comments

Comments
 (0)