Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 71e5870

Browse files
author
Stanislav Idolov
authored
ENGCOM-3205: [Backport] Fix of saving "clone_field" fields #18660
2 parents 94a06c0 + be9fa4a commit 71e5870

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

app/code/Magento/Config/Model/Config.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,14 @@ private function getField(string $sectionId, string $groupId, string $fieldId):
237237
* Get field path
238238
*
239239
* @param Field $field
240+
* @param string $fieldId Need for support of clone_field feature
240241
* @param array &$oldConfig Need for compatibility with _processGroup()
241242
* @param array &$extraOldGroups Need for compatibility with _processGroup()
242243
* @return string
243244
*/
244-
private function getFieldPath(Field $field, array &$oldConfig, array &$extraOldGroups): string
245+
private function getFieldPath(Field $field, string $fieldId, array &$oldConfig, array &$extraOldGroups): string
245246
{
246-
$path = $field->getGroupPath() . '/' . $field->getId();
247+
$path = $field->getGroupPath() . '/' . $fieldId;
247248

248249
/**
249250
* Look for custom defined field path
@@ -303,7 +304,7 @@ private function getChangedPaths(
303304
if (isset($groupData['fields'])) {
304305
foreach ($groupData['fields'] as $fieldId => $fieldData) {
305306
$field = $this->getField($sectionId, $groupId, $fieldId);
306-
$path = $this->getFieldPath($field, $oldConfig, $extraOldGroups);
307+
$path = $this->getFieldPath($field, $fieldId, $oldConfig, $extraOldGroups);
307308
if ($this->isValueChanged($oldConfig, $path, $fieldData)) {
308309
$changedPaths[] = $path;
309310
}
@@ -398,7 +399,7 @@ protected function _processGroup(
398399
$backendModel->addData($data);
399400
$this->_checkSingleStoreMode($field, $backendModel);
400401

401-
$path = $this->getFieldPath($field, $extraOldGroups, $oldConfig);
402+
$path = $this->getFieldPath($field, $fieldId, $extraOldGroups, $oldConfig);
402403
$backendModel->setPath($path)->setValue($fieldData['value']);
403404

404405
$inherit = !empty($fieldData['inherit']);

0 commit comments

Comments
 (0)