Skip to content

Commit 19599b2

Browse files
author
Mark Berube
committed
MC-16111: Fixing column name for store
1 parent 2fcb0f9 commit 19599b2

File tree

1 file changed

+21
-3
lines changed
  • app/code/Magento/Store/Ui/Component/Listing/Column/Store

1 file changed

+21
-3
lines changed

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

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

71+
/**
72+
* Sanitize website/store option name
73+
*
74+
* @return string
75+
*/
76+
protected function sanitizeName($name)
77+
{
78+
$matches = [];
79+
preg_match('/\$[:]*{(.)*}/', $name, $matches);
80+
if (count($matches) > 0) {
81+
$name = $this->escaper->escapeHtml($this->escaper->escapeJs($name));
82+
} else {
83+
$name = $this->escaper->escapeHtml($name);
84+
}
85+
86+
return $name;
87+
}
88+
7189
/**
7290
* Generate current options
7391
*
@@ -88,20 +106,20 @@ protected function generateCurrentOptions()
88106
/** @var \Magento\Store\Model\Store $store */
89107
foreach ($storeCollection as $store) {
90108
if ($store->getGroupId() == $group->getId()) {
91-
$name = $this->escaper->escapeHtml($store->getName());
109+
$name = $this->sanitizeName($store->getName());
92110
$stores[$name]['label'] = str_repeat(' ', 8) . $name;
93111
$stores[$name]['value'] = $store->getId();
94112
}
95113
}
96114
if (!empty($stores)) {
97-
$name = $this->escaper->escapeHtml($group->getName());
115+
$name = $this->sanitizeName($group->getName());
98116
$groups[$name]['label'] = str_repeat(' ', 4) . $name;
99117
$groups[$name]['value'] = array_values($stores);
100118
}
101119
}
102120
}
103121
if (!empty($groups)) {
104-
$name = $this->escaper->escapeHtml($website->getName());
122+
$name = $this->sanitizeName($website->getName());
105123
$this->currentOptions[$name]['label'] = $name;
106124
$this->currentOptions[$name]['value'] = array_values($groups);
107125
}

0 commit comments

Comments
 (0)