Skip to content

Commit 3d01997

Browse files
kweijKlaas van der Weij
authored andcommitted
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 3993417 commit 3d01997

File tree

1 file changed

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

1 file changed

+10
-10
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -427,21 +427,21 @@ private function getFieldData(\Magento\Config\Model\Config\Structure\Element\Fie
427427
if ($data === null) {
428428
if (array_key_exists($path, $this->_configData)) {
429429
$data = $this->_configData[$path];
430-
431-
if ($field->hasBackendModel()) {
432-
$backendModel = $field->getBackendModel();
433-
$backendModel->setPath($path)
434-
->setValue($data)
435-
->setWebsite($this->getWebsiteCode())
436-
->setStore($this->getStoreCode())
437-
->afterLoad();
438-
$data = $backendModel->getValue();
439-
}
440430
} elseif ($field->getConfigPath() !== null) {
441431
$data = $this->getConfigValue($field->getConfigPath());
442432
} else {
443433
$data = $this->getConfigValue($path);
444434
}
435+
436+
if ($field->hasBackendModel()) {
437+
$backendModel = $field->getBackendModel();
438+
$backendModel->setPath($path)
439+
->setValue($data)
440+
->setWebsite($this->getWebsiteCode())
441+
->setStore($this->getStoreCode())
442+
->afterLoad();
443+
$data = $backendModel->getValue();
444+
}
445445
}
446446

447447
return $data;

0 commit comments

Comments
 (0)