Skip to content

Commit 5841082

Browse files
author
Joan He
committed
Merge remote-tracking branch 'arcticfoxes/MAGETWO-99286' into MAGETWO-55094
2 parents 96645ee + d28e807 commit 5841082

File tree

7 files changed

+95
-107
lines changed

7 files changed

+95
-107
lines changed

app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/js.phtml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
7+
// phpcs:disable Magento2.Templates.ThisInTemplate
98
?>
109
<script type="text/x-magento-init">
1110
{
1211
"*": {
1312
"swatchesProductAttributes": {
14-
"hiddenFields": <?= /* @escapeNotVerified */ json_encode($this->helper('Magento\Catalog\Helper\Data')->getAttributeHiddenFields()) ?>
13+
"hiddenFields": <?= /* @noEscape */ json_encode($this->helper(Magento\Catalog\Helper\Data::class)->getAttributeHiddenFields()) ?>
1514
}
1615
}
1716
}

app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/text.phtml

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
/** @var $block \Magento\Swatches\Block\Adminhtml\Attribute\Edit\Options\Text */
108

119
$stores = $block->getStoresSortedBySortOrder();
@@ -20,9 +18,8 @@ $stores = $block->getStoresSortedBySortOrder();
2018
<tr id="swatch-text-options-table">
2119
<th class="col-draggable"></th>
2220
<th class="col-default"><span><?= $block->escapeHtml(__('Is Default')) ?></span></th>
23-
<?php foreach ($stores as $_store): ?>
24-
<th class="col-swatch col-swatch-min-width col-<%- data.id %>
25-
<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> _required<?php endif; ?>"
21+
<?php foreach ($stores as $_store) : ?>
22+
<th class="col-swatch col-swatch-min-width col-<%- data.id %><?= ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID) ? ' _required' : '' ?>"
2623
colspan="2">
2724
<span><?= $block->escapeHtml($_store->getName()) ?></span>
2825
</th>
@@ -41,7 +38,7 @@ $stores = $block->getStoresSortedBySortOrder();
4138
</tr>
4239
<tr>
4340
<th colspan="<?= (int)$colTotal ?>" class="col-actions-add">
44-
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?>
41+
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) : ?>
4542
<button id="add_new_swatch_text_option_button"
4643
title="<?= $block->escapeHtml(__('Add Swatch')) ?>"
4744
type="button" class="action- scalable add">
@@ -57,44 +54,44 @@ $stores = $block->getStoresSortedBySortOrder();
5754
<script id="swatch-text-row-template" type="text/x-magento-template">
5855
<tr>
5956
<td class="col-draggable">
60-
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()): ?>
57+
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) : ?>
6158
<div data-role="draggable-handle"
6259
class="draggable-handle"
63-
title="<?= $block->escapeHtml(__('Sort Option')) ?>"></div>
60+
title="<?= $block->escapeHtmlAttr(__('Sort Option')) ?>"></div>
6461
<?php endif; ?>
6562
<input data-role="order" type="hidden" name="optiontext[order][<%- data.id %>]"
6663
value="<%- data.sort_order %>"
67-
<?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()): ?> disabled="disabled"<?php endif; ?>
64+
<?= ($block->getReadOnly() || $block->canManageOptionDefaultOnly()) ? ' disabled="disabled"' : '' ?>
6865
/>
6966
</td>
7067
<td class="col-default">
7168
<input class="input-radio"
7269
type="<%- data.intype %>"
7370
name="defaulttext[]"
74-
value="<%- data.id %>" <%- data.checked %><?php if ($block->getReadOnly()):?>disabled="disabled"<?php endif;?>/>
71+
value="<%- data.id %>" <%- data.checked %><?= ($block->getReadOnly()) ? ' disabled="disabled"' : '' ?>/>
7572
</td>
76-
<?php foreach ($stores as $_store): ?>
73+
<?php foreach ($stores as $_store) : ?>
7774
<?php $storeId = (int)$_store->getId(); ?>
7875
<td class="col-swatch col-swatch-min-width col-<%- data.id %>">
7976
<input class="input-text
8077
swatch-text-field-<?= /* @noEscape */ $storeId ?>
81-
<?php if ($storeId == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option required-unique<?php endif; ?>"
78+
<?= ($storeId == \Magento\Store\Model\Store::DEFAULT_STORE_ID) ? ' required-option required-unique' : '' ?>"
8279
name="swatchtext[value][<%- data.id %>][<?= /* @noEscape */ $storeId ?>]"
8380
type="text" value="<%- data.swatch<?= /* @noEscape */ $storeId ?> %>"
84-
placeholder="<?= $block->escapeHtml(__("Swatch")) ?>"/>
81+
placeholder="<?= $block->escapeHtmlAttr(__("Swatch")) ?>"/>
8582
</td>
8683
<td class="col-swatch-min-width swatch-col-<%- data.id %>">
8784
<input name="optiontext[value][<%- data.id %>][<?= /* @noEscape */ $storeId ?>]"
8885
value="<%- data.store<?= /* @noEscape */ $storeId ?> %>"
89-
class="input-text<?php if ($storeId == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option<?php endif; ?>"
90-
type="text" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()):?> disabled="disabled"<?php endif;?>
91-
placeholder="<?= $block->escapeHtml(__("Description")) ?>"/>
86+
class="input-text<?= ($storeId == \Magento\Store\Model\Store::DEFAULT_STORE_ID) ? ' required-option' : '' ?>"
87+
type="text" <?= ($block->getReadOnly() || $block->canManageOptionDefaultOnly()) ? ' disabled="disabled"' : ''?>
88+
placeholder="<?= $block->escapeHtmlAttr(__("Description")) ?>"/>
9289
</td>
9390
<?php endforeach; ?>
9491
<td id="delete_button_swatch_container_<%- data.id %>" class="col-delete">
9592
<input type="hidden" class="delete-flag" name="optiontext[delete][<%- data.id %>]" value="" />
96-
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?>
97-
<button title="<?= $block->escapeHtml(__('Delete')) ?>" type="button"
93+
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) : ?>
94+
<button title="<?= $block->escapeHtmlAttr(__('Delete')) ?>" type="button"
9895
class="action- scalable delete delete-option">
9996
<span><?= $block->escapeHtml(__('Delete')) ?></span>
10097
</button>
@@ -105,10 +102,10 @@ $stores = $block->getStoresSortedBySortOrder();
105102
<script type="text/x-magento-init">
106103
{
107104
"*": {
108-
"Magento_Swatches/js/text": <?= /* @escapeNotVerified */ $block->getJsonConfig() ?> ,
105+
"Magento_Swatches/js/text": <?= /* @noEscape */ $block->getJsonConfig() ?> ,
109106
"Magento_Catalog/catalog/product/attribute/unique-validate": {
110107
"element": "required-text-swatch-unique",
111-
"message": "<?= $block->escapeHtml(__("The value of Admin must be unique.")) ?>"
108+
"message": "<?= $block->escapeJs($block->escapeHtml(__("The value of Admin must be unique."))) ?>"
112109
}
113110
}
114111
}

app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
/** @var $block \Magento\Swatches\Block\Adminhtml\Attribute\Edit\Options\Visual */
108

119
$stores = $block->getStoresSortedBySortOrder();
1210
?>
1311
<fieldset class="admin__fieldset fieldset">
1412
<legend class="legend">
15-
<span><?= $block->escapeHtml( __('Manage Swatch (Values of Your Attribute)')) ?></span>
13+
<span><?= $block->escapeHtml(__('Manage Swatch (Values of Your Attribute)')) ?></span>
1614
</legend><br />
1715
<div class="admin__control-table-wrapper" id="swatch-visual-options-panel">
1816
<table class="data-table clearfix" cellspacing="0">
@@ -21,13 +19,12 @@ $stores = $block->getStoresSortedBySortOrder();
2119
<th class="col-draggable"></th>
2220
<th class="col-default"><span><?= $block->escapeHtml(__('Is Default')) ?></span></th>
2321
<th><span><?= $block->escapeHtml(__('Swatch')) ?></span></th>
24-
<?php foreach ($stores as $_store): ?>
25-
<th<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> class="_required"<?php endif; ?>>
22+
<?php foreach ($stores as $_store) : ?>
23+
<th<?= ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID) ? ' class="_required"' : '' ?>
2624
<span><?= $block->escapeHtml($_store->getName()) ?></span>
2725
</th>
28-
<?php endforeach;
29-
$colTotal = count($stores) * 2 + 3;
30-
?>
26+
<?php endforeach; ?>
27+
<?php $colTotal = count($stores) * 2 + 3; ?>
3128
<th class="col-delete">&nbsp;</th>
3229
</tr>
3330
</thead>
@@ -41,7 +38,7 @@ $stores = $block->getStoresSortedBySortOrder();
4138
</tr>
4239
<tr>
4340
<th colspan="<?= (int)$colTotal ?>" class="col-actions-add">
44-
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()): ?>
41+
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) : ?>
4542
<button id="add_new_swatch_visual_option_button"
4643
title="<?= $block->escapeHtml(__('Add Swatch')) ?>"
4744
type="button" class="action- scalable add">
@@ -57,14 +54,14 @@ $stores = $block->getStoresSortedBySortOrder();
5754
<script id="swatch-visual-row-template" type="text/x-magento-template">
5855
<tr>
5956
<td class="col-draggable">
60-
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()): ?>
57+
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) : ?>
6158
<div data-role="draggable-handle" class="draggable-handle"
6259
title="<?= $block->escapeHtml(__('Sort Option')) ?>"></div>
6360
<?php endif; ?>
64-
<input data-role="order" type="hidden" name="optionvisual[order][<%- data.id %>]" value="<%- data.sort_order %>" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()): ?> disabled="disabled"<?php endif; ?>/>
61+
<input data-role="order" type="hidden" name="optionvisual[order][<%- data.id %>]" value="<%- data.sort_order %>" <?= ($block->getReadOnly() || $block->canManageOptionDefaultOnly()) ? ' disabled="disabled"' : '' ?>/>
6562
</td>
6663
<td class="col-default">
67-
<input class="input-radio" type="<%- data.intype %>" name="defaultvisual[]" value="<%- data.id %>" <%- data.checked %><?php if ($block->getReadOnly()):?>disabled="disabled"<?php endif;?>/>
64+
<input class="input-radio" type="<%- data.intype %>" name="defaultvisual[]" value="<%- data.id %>" <%- data.checked %><?= ($block->getReadOnly()) ? ' disabled="disabled"' : '' ?>/>
6865
</td>
6966
<td class="swatches-visual-col col-default <%- data.empty_class %>">
7067
<?php //@todo add logic getting swatch value from db */ ?>
@@ -88,17 +85,17 @@ $stores = $block->getStoresSortedBySortOrder();
8885
</div>
8986
</div>
9087
</td>
91-
<?php foreach ($stores as $_store): ?>
88+
<?php foreach ($stores as $_store) : ?>
9289
<td class="swatch-col-<%- data.id %>">
9390
<input name="optionvisual[value][<%- data.id %>][<?= (int)$_store->getId() ?>]"
9491
value="<%- data.store<?= (int) $_store->getId() ?> %>"
95-
class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option required-unique<?php endif; ?>"
96-
type="text" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()): ?> disabled="disabled"<?php endif; ?>/>
92+
class="input-text<?= ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID) ? ' required-option required-unique' : '' ?>"
93+
type="text" <?= ($block->getReadOnly() || $block->canManageOptionDefaultOnly()) ? ' disabled="disabled"' : '' ?>/>
9794
</td>
9895
<?php endforeach; ?>
9996
<td id="delete_button_swatch_container_<%- data.id %>" class="col-delete">
10097
<input type="hidden" class="delete-flag" name="optionvisual[delete][<%- data.id %>]" value="" />
101-
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?>
98+
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) : ?>
10299
<button title="<?= $block->escapeHtml(__('Delete')) ?>" type="button"
103100
class="action- scalable delete delete-option">
104101
<span><?= $block->escapeHtml(__('Delete')) ?></span>

app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/edit/attribute/steps/attributes_values.phtml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
/* @var $block \Magento\ConfigurableProduct\Block\Adminhtml\Product\Steps\AttributeValues */
108
?>
11-
<div data-bind="scope: '<?= /* @escapeNotVerified */ $block->getComponentName() ?>'">
12-
<h2 class="steps-wizard-title"><?= /* @escapeNotVerified */ __('Step 2: Attribute Values') ?></h2>
9+
<div data-bind="scope: '<?= $block->escapeHtmlAttr($block->getComponentName()) ?>'">
10+
<h2 class="steps-wizard-title"><?= $block->escapeHtml(__('Step 2: Attribute Values')) ?></h2>
1311
<div class="steps-wizard-info">
1412
<span><?= $block->escapeHtml(__('Select from the following attribute values for this product. Each unique combination of values creates a unique product SKU.')) ?></span>
1513
</div>
@@ -25,7 +23,7 @@
2523
<div class="attribute-entity-title" data-bind="text: label"></div>
2624
<div class="attribute-options-block">
2725
(<span class="attribute-length" data-bind="text: $data.options().length"></span>
28-
<?= /* @escapeNotVerified */ __('Options') ?>)
26+
<?= $block->escapeHtml(__('Options')) ?>)
2927
</div>
3028
</div>
3129

@@ -34,19 +32,19 @@
3432
class="action-select-all action-tertiary"
3533
data-bind="click: $parent.selectAllAttributes"
3634
title="<?= $block->escapeHtml(__('Select All')) ?>">
37-
<span><?= /* @escapeNotVerified */ __('Select All') ?></span>
35+
<span><?= $block->escapeHtml(__('Select All')) ?></span>
3836
</button>
3937
<button type="button"
4038
class="action-deselect-all action-tertiary"
4139
data-bind="click: $parent.deSelectAllAttributes"
4240
title="<?= $block->escapeHtml(__('Deselect All')) ?>">
43-
<span><?= /* @escapeNotVerified */ __('Deselect All') ?></span>
41+
<span><?=$block->escapeHtml(__('Deselect All')) ?></span>
4442
</button>
4543
<button type="button"
4644
class="action-remove-all action-tertiary"
4745
data-bind="click: $parent.removeAttribute.bind($parent)"
4846
title="<?= $block->escapeHtml(__('Remove Attribute')) ?>">
49-
<span><?= /* @escapeNotVerified */ __('Remove Attribute') ?></span>
47+
<span><?= $block->escapeHtml(__('Remove Attribute')) ?></span>
5048
</button>
5149
</div>
5250
</div>
@@ -74,14 +72,14 @@
7472
title="<?= $block->escapeHtml(__('Save Option')) ?>"
7573
data-action="save"
7674
data-bind="click: $parents[1].saveOption.bind($parent)">
77-
<span><?= /* @escapeNotVerified */ __('Save Option') ?></span>
75+
<span><?= $block->escapeHtml(__('Save Option')) ?></span>
7876
</button>
7977
<button type="button"
8078
class="action-remove"
8179
title="<?= $block->escapeHtml(__('Remove Option')) ?>"
8280
data-action="remove"
8381
data-bind="click: $parents[1].removeOption.bind($parent)">
84-
<span><?= /* @escapeNotVerified */ __('Remove Option') ?></span>
82+
<span><?= $block->escapeHtml(__('Remove Option')) ?></span>
8583
</button>
8684
</div>
8785
</li>
@@ -91,7 +89,7 @@
9189
type="button"
9290
data-action="addOption"
9391
data-bind="click: $parent.createOption, visible: canCreateOption">
94-
<span><?= /* @escapeNotVerified */ __('Create New Value') ?></span>
92+
<span><?= $block->escapeHtml(__('Create New Value')) ?></span>
9593
</button>
9694
</div>
9795
</div>
@@ -101,11 +99,11 @@
10199
"*": {
102100
"Magento_Ui/js/core/app": {
103101
"components": {
104-
"<?= /* @escapeNotVerified */ $block->getComponentName() ?>": {
102+
"<?= $block->escapeJs($block->getComponentName()) ?>": {
105103
"component": "Magento_ConfigurableProduct/js/variations/steps/attributes_values",
106-
"appendTo": "<?= /* @escapeNotVerified */ $block->getParentComponentName() ?>",
107-
"optionsUrl": "<?= /* @escapeNotVerified */ $block->getUrl('catalog/product_attribute/getAttributes') ?>",
108-
"createOptionsUrl": "<?= /* @escapeNotVerified */ $block->getUrl('catalog/product_attribute/createOptions') ?>"
104+
"appendTo": "<?= $block->escapeJs($block->getParentComponentName()) ?>",
105+
"optionsUrl": "<?= $block->escapeJs($block->escapeUrl($block->getUrl('catalog/product_attribute/getAttributes'))) ?>",
106+
"createOptionsUrl": "<?= $block->escapeJs($block->escapeUrl($block->getUrl('catalog/product_attribute/createOptions'))) ?>"
109107
}
110108
}
111109
}

0 commit comments

Comments
 (0)