Skip to content

Magento_ConfigurableProduct: avoid using deprecated escape* methods f… #31676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(
*/
public function render(\Magento\Framework\DataObject $row)
{
$imageUrl = $row->getImage() && $row->getImage() != 'no_selection' ? $this->escapeHtml(
$imageUrl = $row->getImage() && $row->getImage() != 'no_selection' ? $this->_escaper->escapeHtml(
$this->_productHelper->getImageUrl($row)
) : '';
return $this->_getValue($row) . '<input type="hidden" data-role="image-url" value="' . $imageUrl . '"/>';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
* See COPYING.txt for license details.
*/

/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
/**
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
* @var \Magento\Framework\Escaper $escaper
*/
?>

<?php $scriptString = <<<script
Expand All @@ -30,7 +33,7 @@ editSet.submit = editSet.submit.wrap(function(original) {
if (editSet.currentNode){
if (ConfigurableNodeExists(editSet.currentNode)) {
alert({
content: '{$block->escapeJs(
content: '{$escaper->escapeJs(
__('This group contains attributes used in configurable products. ' .
'Please move these attributes to another group and try again.')
)}'
Expand All @@ -44,7 +47,7 @@ editSet.submit = editSet.submit.wrap(function(original) {
editSet.rightBeforeAppend = editSet.rightBeforeAppend.wrap(function(original, tree, nodeThis, node, newParent) {
if (node.attributes.is_configurable == 1) {
alert({
content: '{$block->escapeJs(
content: '{$escaper->escapeJs(
__('This attribute is used in configurable products. You cannot remove it from the attribute set.')
)}'
});
Expand All @@ -56,7 +59,7 @@ editSet.rightBeforeAppend = editSet.rightBeforeAppend.wrap(function(original, tr
editSet.rightBeforeInsert = editSet.rightBeforeInsert.wrap(function(original, tree, nodeThis, node, newParent) {
if (node.attributes.is_configurable == 1) {
alert({
content: '{$block->escapeJs(
content: '{$escaper->escapeJs(
__('This attribute is used in configurable products. You cannot remove it from the attribute set.')
)}'
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
* See COPYING.txt for license details.
*/

/* @var $block \Magento\ConfigurableProduct\Block\Adminhtml\Product\Composite\Fieldset\Configurable */
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
/**
* @var \Magento\ConfigurableProduct\Block\Adminhtml\Product\Composite\Fieldset\Configurable $block
* @var \Magento\Framework\Escaper $escaper
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
*/
?>
<?php $_product = $block->getProduct(); ?>
<?php $_attributes = $block->decorateArray($block->getAllowAttributes()); ?>
Expand All @@ -17,22 +20,22 @@ $productHelper = $block->getData('productHelper');
<?php if (($_product->isSaleable() || $_skipSaleableCheck) && count($_attributes)):?>
<fieldset id="catalog_product_composite_configure_fields_configurable" class="fieldset admin__fieldset">
<legend class="legend admin__legend">
<span><?= $block->escapeHtml(__('Associated Products')) ?></span>
<span><?= $escaper->escapeHtml(__('Associated Products')) ?></span>
</legend>
<div class="product-options fieldset admin__fieldset">
<?php foreach ($_attributes as $_attribute): ?>
<div class="field admin__field required">
<label class="label admin__field-label"><?=
$block->escapeHtml($_attribute->getProductAttribute()->getStoreLabel($_product->getStoreId()));
$escaper->escapeHtml($_attribute->getProductAttribute()->getStoreLabel($_product->getStoreId()));
?></label>
<div class="control admin__field-control <?php
if ($_attribute->getDecoratedIsLast()):
?> last<?php
endif; ?>">
<select name="super_attribute[<?= $block->escapeHtmlAttr($_attribute->getAttributeId()) ?>]"
id="attribute<?= $block->escapeHtmlAttr($_attribute->getAttributeId()) ?>"
<select name="super_attribute[<?= $escaper->escapeHtmlAttr($_attribute->getAttributeId()) ?>]"
id="attribute<?= $escaper->escapeHtmlAttr($_attribute->getAttributeId()) ?>"
class="admin__control-select required-entry super-attribute-select">
<option><?= $block->escapeHtml(__('Choose an Option...')) ?></option>
<option><?= $escaper->escapeHtml(__('Choose an Option...')) ?></option>
</select>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@
* See COPYING.txt for license details.
*/

/* @var $block \Magento\ConfigurableProduct\Block\Adminhtml\Product\Steps\AttributeValues */
/**
* @var \Magento\ConfigurableProduct\Block\Adminhtml\Product\Steps\AttributeValues $block
* @var \Magento\Framework\Escaper $escaper
*/
$isAllowedToManageAttributes = $block->getPermissions()->isAllowedToManageAttributes();
$attributesUrl = $block->getUrl('catalog/product_attribute/getAttributes');
$optionsUrl = $block->getUrl('catalog/product_attribute/createOptions');
?>
<div data-bind="scope: '<?= /* @noEscape */ $block->getComponentName() ?>'">
<h2 class="steps-wizard-title"><?= $block->escapeHtml(
<h2 class="steps-wizard-title"><?= $escaper->escapeHtml(
__('Step 2: Attribute Values')
); ?></h2>
<div class="steps-wizard-info">
<span><?= $block->escapeHtml(
<span><?= $escaper->escapeHtml(
__('Select values from each attribute to include in this product. ' .
'Each unique combination of values creates a unique product SKU.')
);?></span>
Expand All @@ -26,12 +29,12 @@ $optionsUrl = $block->getUrl('catalog/product_attribute/createOptions');
<div class="attribute-entity-title-block">
<span class="draggable-handle"
data-role="draggable"
title="<?= $block->escapeHtml(__('Sort Variations')) ?>">
title="<?= $escaper->escapeHtml(__('Sort Variations')) ?>">
</span>
<div class="attribute-entity-title" data-bind="text: label"></div>
<div class="attribute-options-block">
(<span class="attribute-length" data-bind="text: $data.options().length"></span>
<?= $block->escapeHtml(
<?= $escaper->escapeHtml(
__('Options')
); ?>)
</div>
Expand All @@ -41,24 +44,24 @@ $optionsUrl = $block->getUrl('catalog/product_attribute/createOptions');
<button type="button"
class="action-select-all action-tertiary"
data-bind="click: $parent.selectAllAttributes"
title="<?= $block->escapeHtml(__('Select All')) ?>">
<span><?= $block->escapeHtml(
title="<?= $escaper->escapeHtml(__('Select All')) ?>">
<span><?= $escaper->escapeHtml(
__('Select All')
); ?></span>
</button>
<button type="button"
class="action-deselect-all action-tertiary"
data-bind="click: $parent.deSelectAllAttributes"
title="<?= $block->escapeHtml(__('Deselect All')) ?>">
<span><?= $block->escapeHtml(
title="<?= $escaper->escapeHtml(__('Deselect All')) ?>">
<span><?= $escaper->escapeHtml(
__('Deselect All')
); ?></span>
</button>
<button type="button"
class="action-remove-all action-tertiary"
data-bind="click: $parent.removeAttribute.bind($parent)"
title="<?= $block->escapeHtml(__('Remove Attribute')) ?>">
<span><?= $block->escapeHtml(
title="<?= $escaper->escapeHtml(__('Remove Attribute')) ?>">
<span><?= $escaper->escapeHtml(
__('Remove Attribute')
); ?></span>
</button>
Expand Down Expand Up @@ -86,19 +89,19 @@ $optionsUrl = $block->getUrl('catalog/product_attribute/createOptions');
</div>
<button type="button"
class="action-save"
title="<?= $block->escapeHtml(__('Save Option')) ?>"
title="<?= $escaper->escapeHtml(__('Save Option')) ?>"
data-action="save"
data-bind="click: $parents[1].saveOption.bind($parent)">
<span><?= $block->escapeHtml(
<span><?= $escaper->escapeHtml(
__('Save Option')
); ?></span>
</button>
<button type="button"
class="action-remove"
title="<?= $block->escapeHtml(__('Remove Option')) ?>"
title="<?= $escaper->escapeHtml(__('Remove Option')) ?>"
data-action="remove"
data-bind="click: $parents[1].removeOption.bind($parent)">
<span><?= $block->escapeHtml(
<span><?= $escaper->escapeHtml(
__('Remove Option')
); ?></span>
</button>
Expand All @@ -111,7 +114,7 @@ $optionsUrl = $block->getUrl('catalog/product_attribute/createOptions');
type="button"
data-action="addOption"
data-bind="click: $parent.createOption, visible: canCreateOption">
<span><?= $block->escapeHtml(__('Create New Value')); ?></span>
<span><?= $escaper->escapeHtml(__('Create New Value')); ?></span>
</button>
<?php endif; ?>
</div>
Expand Down
Loading