Skip to content

Commit f2f1d36

Browse files
authored
Use backend model also for default config values
This causes the ```afterLoad()``` method to be invoked, also for default configuration values from ```config.xml```
1 parent 732d445 commit f2f1d36

File tree

1 file changed

+10
-11
lines changed
  • app/code/Magento/Config/Block/System/Config

1 file changed

+10
-11
lines changed

app/code/Magento/Config/Block/System/Config/Form.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -337,22 +337,21 @@ protected function _initElement(
337337
if (array_key_exists($path, $this->_configData)) {
338338
$data = $this->_configData[$path];
339339
$inherit = false;
340-
341-
if ($field->hasBackendModel()) {
342-
$backendModel = $field->getBackendModel();
343-
$backendModel->setPath($path)
344-
->setValue($data)
345-
->setWebsite($this->getWebsiteCode())
346-
->setStore($this->getStoreCode())
347-
->afterLoad();
348-
$data = $backendModel->getValue();
349-
}
350-
351340
} elseif ($field->getConfigPath() !== null) {
352341
$data = $this->getConfigValue($field->getConfigPath());
353342
} else {
354343
$data = $this->getConfigValue($path);
355344
}
345+
346+
if ($field->hasBackendModel()) {
347+
$backendModel = $field->getBackendModel();
348+
$backendModel->setPath($path)
349+
->setValue($data)
350+
->setWebsite($this->getWebsiteCode())
351+
->setStore($this->getStoreCode())
352+
->afterLoad();
353+
$data = $backendModel->getValue();
354+
}
356355
}
357356
$fieldRendererClass = $field->getFrontendModel();
358357
if ($fieldRendererClass) {

0 commit comments

Comments
 (0)