Skip to content

Commit 8956db7

Browse files
author
Oleksii Korshenko
committed
MAGETWO-70797: Use backend model also for default config values #7742
- Merge Pull Request #7742 from kweij/magento2:patch-2 - Merged commits: 1. f2f1d36 2. 38f1343 3. 3d01997 4. 94b9511 5. e8981b8
2 parents ce5dbd5 + e8981b8 commit 8956db7

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
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;

app/code/Magento/Config/Test/Unit/Block/System/Config/FormTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ public function initFieldsDataProvider()
676676
true,
677677
'Config Value',
678678
null,
679-
0,
679+
1,
680680
true,
681681
false,
682682
true

0 commit comments

Comments
 (0)