Skip to content

Commit 3949cdb

Browse files
committed
MAGETWO-92931: HTML entities in product name do not display properly in breadcrumb
- rename method for static test
1 parent 299ef7f commit 3949cdb

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

app/code/Magento/Catalog/ViewModel/Product/Breadcrumbs.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ public function getProductName(): string
9595
}
9696

9797
/**
98-
* Returns breadcrumb json.
98+
* Returns breadcrumb json with html escaped names
9999
*
100100
* @return string
101101
*/
102-
public function getJsonConfiguration() : string
102+
public function getJsonConfigurationHtmlEscaped() : string
103103
{
104104
return json_encode(
105105
[
@@ -112,4 +112,15 @@ public function getJsonConfiguration() : string
112112
JSON_HEX_TAG
113113
);
114114
}
115+
116+
/**
117+
* Returns breadcrumb json.
118+
*
119+
* @return string
120+
* @deprecated in favor of new method with name {suffix}Html{postfix}()
121+
*/
122+
public function getJsonConfiguration()
123+
{
124+
return $this->getJsonConfigurationHtmlEscaped();
125+
}
115126
}

app/code/Magento/Catalog/view/frontend/templates/product/breadcrumbs.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ $viewModel = $block->getData('viewModel');
1010
<div class="breadcrumbs"></div>
1111
<script type="text/x-magento-init">
1212
{
13-
".breadcrumbs": <?= $viewModel->getJsonConfiguration() ?>
13+
".breadcrumbs": <?= $viewModel->getJsonConfigurationHtmlEscaped() ?>
1414
}
1515
</script>

0 commit comments

Comments
 (0)