Skip to content

Commit 5905592

Browse files
committed
MC-18762: Fix incorrect website name rendering
1 parent bd30060 commit 5905592

File tree

4 files changed

+17
-24
lines changed

4 files changed

+17
-24
lines changed

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Websites.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ protected function getFieldsForFieldset()
188188
'componentType' => Form\Field::NAME,
189189
'formElement' => Form\Element\Checkbox::NAME,
190190
'description' => __($website['name']),
191+
'__disableTmpl' => true,
191192
'tooltip' => $tooltip,
192193
'sortOrder' => $sortOrder,
193194
'dataScope' => 'website_ids.' . $website['id'],
@@ -353,18 +354,21 @@ protected function getWebsitesOptionsList()
353354
$websiteOption = [
354355
'value' => '0.' . $website['id'],
355356
'label' => __($website['name']),
357+
'__disableTmpl' => true,
356358
];
357359
$groupOptions = [];
358360
foreach ($website['groups'] as $group) {
359361
$groupOption = [
360362
'value' => '0.' . $website['id'] . '.' . $group['id'],
361363
'label' => __($group['name']),
364+
'__disableTmpl' => true,
362365
];
363366
$storeViewOptions = [];
364367
foreach ($group['stores'] as $storeView) {
365368
$storeViewOptions[] = [
366369
'value' => $storeView['id'],
367370
'label' => __($storeView['name']),
371+
'__disableTmpl' => true,
368372
];
369373
}
370374
if (!empty($storeViewOptions)) {

app/code/Magento/Store/Model/System/Store.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ public function getStoreValuesForForm($empty = false, $all = false)
142142
$values[] = [
143143
'label' => str_repeat($nonEscapableNbspChar, 4) . $store->getName(),
144144
'value' => $store->getId(),
145+
'__disableTmpl' => true,
145146
];
146147
}
147148
if ($groupShow) {

app/code/Magento/Store/Test/Unit/Model/System/StoreTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,11 @@ public function getStoreValuesForFormDataProvider()
268268
[
269269
'label' => str_repeat($nonEscapableNbspChar, 4) . $groupName,
270270
'value' => [
271-
['label' => str_repeat($nonEscapableNbspChar, 4) . $storeName, 'value' => $storeId]
271+
[
272+
'label' => str_repeat($nonEscapableNbspChar, 4) . $storeName,
273+
'value' => $storeId,
274+
'__disableTmpl' => true,
275+
]
272276
],
273277
'__disableTmpl' => true
274278
],

app/code/Magento/Store/Ui/Component/Listing/Column/Store/Options.php

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -68,26 +68,6 @@ public function toOptionArray()
6868
return $this->options;
6969
}
7070

71-
/**
72-
* Sanitize website/store option name
73-
*
74-
* @param string $name
75-
*
76-
* @return string
77-
*/
78-
protected function sanitizeName($name)
79-
{
80-
$matches = [];
81-
preg_match('/\$[:]*{(.)*}/', $name, $matches);
82-
if (count($matches) > 0) {
83-
$name = $this->escaper->escapeHtml($this->escaper->escapeJs($name));
84-
} else {
85-
$name = $this->escaper->escapeHtml($name);
86-
}
87-
88-
return $name;
89-
}
90-
9171
/**
9272
* Generate current options
9373
*
@@ -108,22 +88,26 @@ protected function generateCurrentOptions()
10888
/** @var \Magento\Store\Model\Store $store */
10989
foreach ($storeCollection as $store) {
11090
if ($store->getGroupId() == $group->getId()) {
111-
$name = $this->sanitizeName($store->getName());
91+
$name = $store->getName();
11292
$stores[$name]['label'] = str_repeat(' ', 8) . $name;
11393
$stores[$name]['value'] = $store->getId();
94+
$stores[$name]['__disableTmpl'] = true;
11495
}
11596
}
11697
if (!empty($stores)) {
117-
$name = $this->sanitizeName($group->getName());
98+
$name = $group->getName();
11899
$groups[$name]['label'] = str_repeat(' ', 4) . $name;
119100
$groups[$name]['value'] = array_values($stores);
101+
$groups[$name]['__disableTmpl'] = true;
102+
120103
}
121104
}
122105
}
123106
if (!empty($groups)) {
124-
$name = $this->sanitizeName($website->getName());
107+
$name = $website->getName();
125108
$this->currentOptions[$name]['label'] = $name;
126109
$this->currentOptions[$name]['value'] = array_values($groups);
110+
$this->currentOptions[$name]['__disableTmpl'] = true;
127111
}
128112
}
129113
}

0 commit comments

Comments
 (0)