Skip to content

Commit 3d97c12

Browse files
author
Stanislav Idolov
authored
ENGCOM-3060: Fix of saving "clone_field" fields #18160
2 parents ad9d867 + 95ebff5 commit 3d97c12

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 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']);
@@ -604,4 +605,4 @@ public function getConfigDataValue($path, &$inherit = null, $configData = null)
604605

605606
return $data;
606607
}
607-
}
608+
}

0 commit comments

Comments
 (0)