Skip to content

Commit

Permalink
ENGCOM-3205: [Backport] Fix of saving "clone_field" fields magento#18660
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Idolov authored Oct 23, 2018
2 parents 94a06c0 + be9fa4a commit 71e5870
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/code/Magento/Config/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,14 @@ private function getField(string $sectionId, string $groupId, string $fieldId):
* Get field path
*
* @param Field $field
* @param string $fieldId Need for support of clone_field feature
* @param array &$oldConfig Need for compatibility with _processGroup()
* @param array &$extraOldGroups Need for compatibility with _processGroup()
* @return string
*/
private function getFieldPath(Field $field, array &$oldConfig, array &$extraOldGroups): string
private function getFieldPath(Field $field, string $fieldId, array &$oldConfig, array &$extraOldGroups): string
{
$path = $field->getGroupPath() . '/' . $field->getId();
$path = $field->getGroupPath() . '/' . $fieldId;

/**
* Look for custom defined field path
Expand Down Expand Up @@ -303,7 +304,7 @@ private function getChangedPaths(
if (isset($groupData['fields'])) {
foreach ($groupData['fields'] as $fieldId => $fieldData) {
$field = $this->getField($sectionId, $groupId, $fieldId);
$path = $this->getFieldPath($field, $oldConfig, $extraOldGroups);
$path = $this->getFieldPath($field, $fieldId, $oldConfig, $extraOldGroups);
if ($this->isValueChanged($oldConfig, $path, $fieldData)) {
$changedPaths[] = $path;
}
Expand Down Expand Up @@ -398,7 +399,7 @@ protected function _processGroup(
$backendModel->addData($data);
$this->_checkSingleStoreMode($field, $backendModel);

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

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

0 comments on commit 71e5870

Please sign in to comment.