Skip to content

Magento_Swatches: avoid using deprecated escape* methods from Abstrac… #31723

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 1 commit 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 @@ -4,24 +4,27 @@
* See COPYING.txt for license details.
*/

/** @var $block \Magento\Swatches\Block\Adminhtml\Attribute\Edit\Options\Text */
/**
* @var $block \Magento\Swatches\Block\Adminhtml\Attribute\Edit\Options\Text
* @var \Magento\Framework\Escaper $escaper
*/

$stores = $block->getStoresSortedBySortOrder();
?>
<fieldset class="fieldset">
<legend class="legend">
<span><?= $block->escapeHtml(__('Manage Swatch (Values of Your Attribute)')) ?></span>
<span><?= $escaper->escapeHtml(__('Manage Swatch (Values of Your Attribute)')) ?></span>
</legend>
<div id="swatch-text-options-panel">
<table class="data-table clearfix" cellspacing="0">
<thead>
<tr id="swatch-text-options-table">
<th class="col-draggable"></th>
<th class="col-default"><span><?= $block->escapeHtml(__('Is Default')) ?></span></th>
<th class="col-default"><span><?= $escaper->escapeHtml(__('Is Default')) ?></span></th>
<?php foreach ($stores as $_store) : ?>
<th class="col-swatch col-swatch-min-width col-<%- data.id %><?= ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID) ? ' _required' : '' ?>"
colspan="2">
<span><?= $block->escapeHtml($_store->getName()) ?></span>
<span><?= $escaper->escapeHtml($_store->getName()) ?></span>
</th>
<?php endforeach; ?>
<?php $colTotal = count($stores) * 2 + 3; ?>
Expand All @@ -40,9 +43,9 @@ $stores = $block->getStoresSortedBySortOrder();
<th colspan="<?= (int)$colTotal ?>" class="col-actions-add">
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) : ?>
<button id="add_new_swatch_text_option_button"
title="<?= $block->escapeHtml(__('Add Swatch')) ?>"
title="<?= $escaper->escapeHtml(__('Add Swatch')) ?>"
type="button" class="action- scalable add">
<span><?= $block->escapeHtml(__('Add Swatch')) ?></span>
<span><?= $escaper->escapeHtml(__('Add Swatch')) ?></span>
</button>
<?php endif; ?>
</th>
Expand All @@ -57,7 +60,7 @@ $stores = $block->getStoresSortedBySortOrder();
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) : ?>
<div data-role="draggable-handle"
class="draggable-handle"
title="<?= $block->escapeHtmlAttr(__('Sort Option')) ?>"></div>
title="<?= $escaper->escapeHtmlAttr(__('Sort Option')) ?>"></div>
<?php endif; ?>
<input data-role="order" type="hidden" name="optiontext[order][<%- data.id %>]"
value="<%- data.sort_order %>"
Expand All @@ -78,22 +81,22 @@ $stores = $block->getStoresSortedBySortOrder();
<?= ($storeId == \Magento\Store\Model\Store::DEFAULT_STORE_ID) ? ' required-option required-unique' : '' ?>"
name="swatchtext[value][<%- data.id %>][<?= /* @noEscape */ $storeId ?>]"
type="text" value="<%- data.swatch<?= /* @noEscape */ $storeId ?> %>"
placeholder="<?= $block->escapeHtmlAttr(__("Swatch")) ?>"/>
placeholder="<?= $escaper->escapeHtmlAttr(__("Swatch")) ?>"/>
</td>
<td class="col-swatch-min-width swatch-col-<%- data.id %>">
<input name="optiontext[value][<%- data.id %>][<?= /* @noEscape */ $storeId ?>]"
value="<%- data.store<?= /* @noEscape */ $storeId ?> %>"
class="input-text<?= ($storeId == \Magento\Store\Model\Store::DEFAULT_STORE_ID) ? ' required-option' : '' ?>"
type="text" <?= ($block->getReadOnly() || $block->canManageOptionDefaultOnly()) ? ' disabled="disabled"' : ''?>
placeholder="<?= $block->escapeHtmlAttr(__("Description")) ?>"/>
placeholder="<?= $escaper->escapeHtmlAttr(__("Description")) ?>"/>
</td>
<?php endforeach; ?>
<td id="delete_button_swatch_container_<%- data.id %>" class="col-delete">
<input type="hidden" class="delete-flag" name="optiontext[delete][<%- data.id %>]" value="" />
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) : ?>
<button title="<?= $block->escapeHtmlAttr(__('Delete')) ?>" type="button"
<button title="<?= $escaper->escapeHtmlAttr(__('Delete')) ?>" type="button"
class="action- scalable delete delete-option">
<span><?= $block->escapeHtml(__('Delete')) ?></span>
<span><?= $escaper->escapeHtml(__('Delete')) ?></span>
</button>
<?php endif;?>
</td>
Expand All @@ -105,7 +108,7 @@ $stores = $block->getStoresSortedBySortOrder();
"Magento_Swatches/js/text": <?= /* @noEscape */ $block->getJsonConfig() ?> ,
"Magento_Catalog/catalog/product/attribute/unique-validate": {
"element": "required-text-swatch-unique",
"message": "<?= $block->escapeJs($block->escapeHtml(__("The value of Admin must be unique."))) ?>"
"message": "<?= $escaper->escapeJs($escaper->escapeHtml(__("The value of Admin must be unique."))) ?>"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,27 @@
* See COPYING.txt for license details.
*/

/** @var $block \Magento\Swatches\Block\Adminhtml\Attribute\Edit\Options\Visual */
/**
* @var $block \Magento\Swatches\Block\Adminhtml\Attribute\Edit\Options\Visual
* @var \Magento\Framework\Escaper $escaper
*/

$stores = $block->getStoresSortedBySortOrder();
?>
<fieldset class="admin__fieldset fieldset">
<legend class="legend">
<span><?= $block->escapeHtml(__('Manage Swatch (Values of Your Attribute)')) ?></span>
<span><?= $escaper->escapeHtml(__('Manage Swatch (Values of Your Attribute)')) ?></span>
</legend><br />
<div class="admin__control-table-wrapper" id="swatch-visual-options-panel">
<table class="data-table clearfix" cellspacing="0">
<thead>
<tr id="swatch-visual-options-table">
<th class="col-draggable"></th>
<th class="col-default"><span><?= $block->escapeHtml(__('Is Default')) ?></span></th>
<th><span><?= $block->escapeHtml(__('Swatch')) ?></span></th>
<th class="col-default"><span><?= $escaper->escapeHtml(__('Is Default')) ?></span></th>
<th><span><?= $escaper->escapeHtml(__('Swatch')) ?></span></th>
<?php foreach ($stores as $_store) : ?>
<th<?= ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID) ? ' class="_required"' : '' ?>
<span><?= $block->escapeHtml($_store->getName()) ?></span>
<span><?= $escaper->escapeHtml($_store->getName()) ?></span>
</th>
<?php endforeach; ?>
<?php $colTotal = count($stores) * 2 + 3; ?>
Expand All @@ -40,9 +43,9 @@ $stores = $block->getStoresSortedBySortOrder();
<th colspan="<?= (int)$colTotal ?>" class="col-actions-add">
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) : ?>
<button id="add_new_swatch_visual_option_button"
title="<?= $block->escapeHtml(__('Add Swatch')) ?>"
title="<?= $escaper->escapeHtml(__('Add Swatch')) ?>"
type="button" class="action- scalable add">
<span><?= $block->escapeHtml(__('Add Swatch')) ?></span>
<span><?= $escaper->escapeHtml(__('Add Swatch')) ?></span>
</button>
<?php endif; ?>
</th>
Expand All @@ -56,7 +59,7 @@ $stores = $block->getStoresSortedBySortOrder();
<td class="col-draggable">
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) : ?>
<div data-role="draggable-handle" class="draggable-handle"
title="<?= $block->escapeHtml(__('Sort Option')) ?>"></div>
title="<?= $escaper->escapeHtml(__('Sort Option')) ?>"></div>
<?php endif; ?>
<input data-role="order" type="hidden" name="optionvisual[order][<%- data.id %>]" value="<%- data.sort_order %>" <?= ($block->getReadOnly() || $block->canManageOptionDefaultOnly()) ? ' disabled="disabled"' : '' ?>/>
</td>
Expand All @@ -70,17 +73,17 @@ $stores = $block->getStoresSortedBySortOrder();
<div class="swatch_sub-menu_container" id="swatch_container_option_<%- data.id %>">
<div class="swatch_row position-relative">
<div class="swatch_row_name colorpicker_handler">
<p><?= $block->escapeHtml(__('Choose a color')) ?></p>
<p><?= $escaper->escapeHtml(__('Choose a color')) ?></p>
</div>
</div>
<div class="swatch_row">
<div class="swatch_row_name btn_choose_file_upload" id="swatch_choose_file_option_<%- data.id %>">
<p><?= $block->escapeHtml(__('Upload a file')) ?></p>
<p><?= $escaper->escapeHtml(__('Upload a file')) ?></p>
</div>
</div>
<div class="swatch_row">
<div class="swatch_row_name btn_remove_swatch">
<p><?= $block->escapeHtml(__('Clear')) ?></p>
<p><?= $escaper->escapeHtml(__('Clear')) ?></p>
</div>
</div>
</div>
Expand All @@ -96,9 +99,9 @@ $stores = $block->getStoresSortedBySortOrder();
<td id="delete_button_swatch_container_<%- data.id %>" class="col-delete">
<input type="hidden" class="delete-flag" name="optionvisual[delete][<%- data.id %>]" value="" />
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) : ?>
<button title="<?= $block->escapeHtml(__('Delete')) ?>" type="button"
<button title="<?= $escaper->escapeHtml(__('Delete')) ?>" type="button"
class="action- scalable delete delete-option">
<span><?= $block->escapeHtml(__('Delete')) ?></span>
<span><?= $escaper->escapeHtml(__('Delete')) ?></span>
</button>
<?php endif;?>
</td>
Expand All @@ -110,7 +113,7 @@ $stores = $block->getStoresSortedBySortOrder();
"Magento_Swatches/js/visual": <?= /* @noEscape */ $block->getJsonConfig() ?> ,
"Magento_Catalog/catalog/product/attribute/unique-validate": {
"element": "required-visual-swatch-unique",
"message": "<?= $block->escapeHtml(__("The value of Admin must be unique.")) ?>"
"message": "<?= $escaper->escapeHtml(__("The value of Admin must be unique.")) ?>"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
* See COPYING.txt for license details.
*/

/* @var $block \Magento\ConfigurableProduct\Block\Adminhtml\Product\Steps\AttributeValues */
/**
* @var $block \Magento\ConfigurableProduct\Block\Adminhtml\Product\Steps\AttributeValues
* @var \Magento\Framework\Escaper $escaper
*/
?>
<div data-bind="scope: '<?= $block->escapeHtmlAttr($block->getComponentName()) ?>'">
<h2 class="steps-wizard-title"><?= $block->escapeHtml(__('Step 2: Attribute Values')) ?></h2>
<div data-bind="scope: '<?= $escaper->escapeHtmlAttr($block->getComponentName()) ?>'">
<h2 class="steps-wizard-title"><?= $escaper->escapeHtml(__('Step 2: Attribute Values')) ?></h2>
<div class="steps-wizard-info">
<span><?= $block->escapeHtml(__('Select from the following attribute values for this product. Each unique combination of values creates a unique product SKU.')) ?></span>
<span><?= $escaper->escapeHtml(__('Select from the following attribute values for this product. Each unique combination of values creates a unique product SKU.')) ?></span>
</div>
<div data-bind="foreach: attributes, sortableList: attributes">

Expand All @@ -18,33 +21,33 @@
<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(__('Options')) ?>)
<?= $escaper->escapeHtml(__('Options')) ?>)
</div>
</div>

<div class="attribute-entity-actions">
<button type="button"
class="action-select-all action-tertiary"
data-bind="click: $parent.selectAllAttributes"
title="<?= $block->escapeHtml(__('Select All')) ?>">
<span><?= $block->escapeHtml(__('Select All')) ?></span>
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(__('Deselect All')) ?></span>
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(__('Remove Attribute')) ?></span>
title="<?= $escaper->escapeHtml(__('Remove Attribute')) ?>">
<span><?= $escaper->escapeHtml(__('Remove Attribute')) ?></span>
</button>
</div>
</div>
Expand All @@ -69,17 +72,17 @@
</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(__('Save Option')) ?></span>
<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(__('Remove Option')) ?></span>
<span><?= $escaper->escapeHtml(__('Remove Option')) ?></span>
</button>
</div>
</li>
Expand All @@ -89,7 +92,7 @@
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>
</div>
</div>
Expand All @@ -99,11 +102,11 @@
"*": {
"Magento_Ui/js/core/app": {
"components": {
"<?= $block->escapeJs($block->getComponentName()) ?>": {
"<?= $escaper->escapeJs($block->getComponentName()) ?>": {
"component": "Magento_ConfigurableProduct/js/variations/steps/attributes_values",
"appendTo": "<?= $block->escapeJs($block->getParentComponentName()) ?>",
"optionsUrl": "<?= $block->escapeJs($block->escapeUrl($block->getUrl('catalog/product_attribute/getAttributes'))) ?>",
"createOptionsUrl": "<?= $block->escapeJs($block->escapeUrl($block->getUrl('catalog/product_attribute/createOptions'))) ?>"
"appendTo": "<?= $escaper->escapeJs($block->getParentComponentName()) ?>",
"optionsUrl": "<?= $escaper->escapeJs($escaper->escapeUrl($block->getUrl('catalog/product_attribute/getAttributes'))) ?>",
"createOptionsUrl": "<?= $escaper->escapeJs($escaper->escapeUrl($block->getUrl('catalog/product_attribute/createOptions'))) ?>"
}
}
}
Expand Down
Loading