Skip to content

Commit 024d7c0

Browse files
ENGCOM-5048: Fixed #22484 Customer address States are duplicated in backend #22637
2 parents d1c4994 + 23dd39f commit 024d7c0

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

app/code/Magento/Ui/Component/Form/Element/AbstractOptionsField.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
use Magento\Framework\View\Element\UiComponent\ContextInterface;
1010

1111
/**
12+
* Base abstract form element.
13+
*
14+
* phpcs:disable Magento2.Classes.AbstractApi
1215
* @api
1316
* @since 100.1.0
1417
*/
@@ -59,7 +62,7 @@ public function prepare()
5962
if (empty($config['rawOptions'])) {
6063
$options = $this->convertOptionsValueToString($options);
6164
}
62-
$config['options'] = array_values(array_merge_recursive($config['options'], $options));
65+
$config['options'] = array_values(array_replace_recursive($config['options'], $options));
6366
}
6467
$this->setData('config', (array)$config);
6568
parent::prepare();
@@ -84,11 +87,14 @@ abstract public function getIsSelected($optionValue);
8487
*/
8588
protected function convertOptionsValueToString(array $options)
8689
{
87-
array_walk($options, function (&$value) {
88-
if (isset($value['value']) && is_scalar($value['value'])) {
89-
$value['value'] = (string)$value['value'];
90+
array_walk(
91+
$options,
92+
static function (&$value) {
93+
if (isset($value['value']) && is_scalar($value['value'])) {
94+
$value['value'] = (string)$value['value'];
95+
}
9096
}
91-
});
97+
);
9298
return $options;
9399
}
94100
}

0 commit comments

Comments
 (0)