Skip to content

Commit 027704a

Browse files
author
Hwashiang Yu
committed
MAGETWO-55808: Eliminate @escapeNotVerified in Product Modules
- Resolved static failures in bundle, configurable product, downloadable, and grouped product module templates
1 parent 40c489d commit 027704a

File tree

78 files changed

+718
-978
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+718
-978
lines changed

app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml

Lines changed: 5 additions & 7 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\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Attributes\Extend */
108
$elementHtml = $block->getParentElementHtml();
119

@@ -20,7 +18,7 @@ $isElementReadonly = $block->getElement()
2018
->getReadonly();
2119
?>
2220

23-
<?php if (!($attributeCode === 'price' && $block->getCanReadPrice() === false)): ?>
21+
<?php if (!($attributeCode === 'price' && $block->getCanReadPrice() === false)) : ?>
2422
<div class="<?= $block->escapeHtmlAttr($attributeCode) ?> "><?= /* @noEscape */ $elementHtml ?></div>
2523
<?php endif; ?>
2624

@@ -43,10 +41,10 @@ $isElementReadonly = $block->getElement()
4341
} else {
4442
if ($attribute) {
4543
<?php if ($attributeCode === 'price' && !$block->getCanEditPrice() && $block->getCanReadPrice()
46-
&& $block->getProduct()->isObjectNew()): ?>
47-
<?php $defaultProductPrice = $block->getDefaultProductPrice() ?: "''"; ?>
44+
&& $block->getProduct()->isObjectNew()) : ?>
45+
<?php $defaultProductPrice = $block->getDefaultProductPrice() ?: "''"; ?>
4846
$attribute.value = <?= $block->escapeJs($defaultProductPrice) ?>;
49-
<?php else: ?>
47+
<?php else : ?>
5048
$attribute.disabled = false;
5149
$attribute.addClassName('required-entry');
5250
<?php endif; ?>
@@ -58,7 +56,7 @@ $isElementReadonly = $block->getElement()
5856
}
5957

6058
<?php if (!($attributeCode === 'price' && !$block->getCanEditPrice()
61-
&& !$block->getProduct()->isObjectNew())): ?>
59+
&& !$block->getProduct()->isObjectNew())) : ?>
6260
$('<?= $block->escapeJs($switchAttributeCode) ?>').observe('change', <?= $block->escapeJs($switchAttributeCode) ?>_change);
6361
<?php endif; ?>
6462
Event.observe(window, 'load', function(){

app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/bundle.phtml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
?>
107

118
<?php /* @var $block \Magento\Bundle\Block\Adminhtml\Catalog\Product\Composite\Fieldset\Bundle */ ?>
129
<?php $options = $block->decorateArray($block->getOptions(true)); ?>
13-
<?php if (count($options)): ?>
10+
<?php if (count($options)) : ?>
1411
<fieldset id="catalog_product_composite_configure_fields_bundle"
1512
class="fieldset admin__fieldset composite-bundle<?= $block->getIsLastFieldset() ? ' last-fieldset' : '' ?>">
1613
<legend class="legend admin__legend">

app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/checkbox.phtml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,39 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
?>
107
<?php /* @var $block \Magento\Bundle\Block\Adminhtml\Catalog\Product\Composite\Fieldset\Options\Type\Checkbox */ ?>
118
<?php $_option = $block->getOption(); ?>
129
<?php $_selections = $_option->getSelections(); ?>
13-
<?php $_skipSaleableCheck = $this->helper('Magento\Catalog\Helper\Product')->getSkipSaleableCheck(); ?>
10+
<?php $_skipSaleableCheck = $this->helper(Magento\Catalog\Helper\Product::class)->getSkipSaleableCheck(); ?>
1411

15-
<div class="field admin__field options<?php if ($_option->getRequired()) echo ' required _required' ?>">
12+
<div class="field admin__field options<?php if ($_option->getRequired()) { echo ' required _required'; } ?>">
1613
<label class="label admin__field-label">
1714
<span><?= $block->escapeHtml($_option->getTitle()) ?></span>
1815
</label>
1916

2017
<div class="control admin__field-control">
21-
<div class="nested <?php if ($_option->getDecoratedIsLast()):?> last<?php endif;?>">
18+
<div class="nested <?php if ($_option->getDecoratedIsLast()) :?> last<?php endif;?>">
2219

23-
<?php if (count($_selections) == 1 && $_option->getRequired()): ?>
20+
<?php if (count($_selections) == 1 && $_option->getRequired()) : ?>
2421
<?= /* @noEscape */ $block->getSelectionQtyTitlePrice($_selections[0]) ?>
2522
<input type="hidden"
2623
name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
2724
value="<?= $block->escapeHtmlAttr($_selections[0]->getSelectionId()) ?>"
2825
price="<?= $block->escapeHtmlAttr($block->getSelectionPrice($_selections[0])) ?>" />
29-
<?php else:?>
26+
<?php else :?>
3027

31-
<?php foreach ($_selections as $_selection): ?>
28+
<?php foreach ($_selections as $_selection) : ?>
3229
<div class="field choice admin__field admin__field-option">
3330
<input
34-
class="change-container-classname admin__control-checkbox checkbox bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?> <?php if ($_option->getRequired()) echo 'validate-one-required-by-name' ?>"
31+
class="change-container-classname admin__control-checkbox checkbox bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?> <?php if ($_option->getRequired()) { echo 'validate-one-required-by-name'; } ?>"
3532
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"
3633
type="checkbox"
3734
name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>][<?= $block->escapeHtmlAttr($_selection->getId()) ?>]"
38-
<?php if ($block->isSelected($_selection)):?>
35+
<?php if ($block->isSelected($_selection)) :?>
3936
<?= ' checked="checked"' ?>
4037
<?php endif;?>
41-
<?php if (!$_selection->isSaleable() && !$_skipSaleableCheck):?>
38+
<?php if (!$_selection->isSaleable() && !$_skipSaleableCheck) :?>
4239
<?= ' disabled="disabled"' ?>
4340
<?php endif;?>
4441
value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"
@@ -50,7 +47,7 @@
5047
<span><?= /* @noEscape */ $block->getSelectionQtyTitlePrice($_selection) ?></span>
5148
</label>
5249

53-
<?php if ($_option->getRequired()): ?>
50+
<?php if ($_option->getRequired()) : ?>
5451
<?= /* @noEscape */ $block->setValidationContainer('bundle-option-' . $_option->getId() . '-' . $_selection->getSelectionId(), 'bundle-option-' . $_option->getId() . '-container') ?>
5552
<?php endif;?>
5653
</div>

app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/multi.phtml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,31 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
?>
107
<?php /* @var $block \Magento\Bundle\Block\Adminhtml\Catalog\Product\Composite\Fieldset\Options\Type\Multi */ ?>
118
<?php $_option = $block->getOption(); ?>
129
<?php $_selections = $_option->getSelections(); ?>
13-
<?php $_skipSaleableCheck = $this->helper('Magento\Catalog\Helper\Product')->getSkipSaleableCheck(); ?>
14-
<div class="field admin__field <?php if ($_option->getRequired()) echo ' required' ?><?php if ($_option->getDecoratedIsLast()):?> last<?php endif; ?>">
10+
<?php $_skipSaleableCheck = $this->helper(Magento\Catalog\Helper\Product::class)->getSkipSaleableCheck(); ?>
11+
<div class="field admin__field <?php if ($_option->getRequired()) { echo ' required'; } ?><?php if ($_option->getDecoratedIsLast()) :?> last<?php endif; ?>">
1512
<label class="label admin__field-label"><span><?= $block->escapeHtml($_option->getTitle()) ?></span></label>
1613
<div class="control admin__field-control">
17-
<?php if (count($_selections) == 1 && $_option->getRequired()): ?>
14+
<?php if (count($_selections) == 1 && $_option->getRequired()) : ?>
1815
<?= /* @noEscape */ $block->getSelectionQtyTitlePrice($_selections[0]) ?>
1916
<input type="hidden" name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
2017
value="<?= $block->escapeHtmlAttr($_selections[0]->getSelectionId()) ?>"
2118
price="<?= $block->escapeHtmlAttr($block->getSelectionPrice($_selections[0])) ?>" />
22-
<?php else: ?>
19+
<?php else : ?>
2320
<select multiple="multiple" size="5" id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>"
2421
name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>][]"
25-
class="admin__control-multiselect bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?><?php if ($_option->getRequired()) echo ' required-entry' ?> multiselect change-container-classname"
22+
class="admin__control-multiselect bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?><?php if ($_option->getRequired()) { echo ' required-entry'; } ?> multiselect change-container-classname"
2623
onchange="ProductConfigure.bundleControl.changeSelection(this)">
27-
<?php if(!$_option->getRequired()): ?>
24+
<?php if (!$_option->getRequired()) : ?>
2825
<option value=""><?= $block->escapeHtml(__('None')) ?></option>
2926
<?php endif; ?>
30-
<?php foreach ($_selections as $_selection): ?>
27+
<?php foreach ($_selections as $_selection) : ?>
3128
<option value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"
32-
<?php if ($block->isSelected($_selection)) echo ' selected="selected"' ?>
33-
<?php if (!$_selection->isSaleable() && !$_skipSaleableCheck) echo ' disabled="disabled"' ?>
29+
<?php if ($block->isSelected($_selection)) { echo ' selected="selected"'; } ?>
30+
<?php if (!$_selection->isSaleable() && !$_skipSaleableCheck) { echo ' disabled="disabled"'; } ?>
3431
price="<?= $block->escapeHtmlAttr($block->getSelectionPrice($_selection)) ?>">
3532
<?= /* @noEscape */ $block->getSelectionQtyTitlePrice($_selection, false) ?></option>
3633
<?php endforeach; ?>

app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/radio.phtml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,26 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
?>
107
<?php /* @var $block \Magento\Bundle\Block\Adminhtml\Catalog\Product\Composite\Fieldset\Options\Type\Radio */ ?>
118
<?php $_option = $block->getOption(); ?>
129
<?php $_selections = $_option->getSelections(); ?>
1310
<?php $_default = $_option->getDefaultSelection(); ?>
14-
<?php $_skipSaleableCheck = $this->helper('Magento\Catalog\Helper\Product')->getSkipSaleableCheck(); ?>
11+
<?php $_skipSaleableCheck = $this->helper(Magento\Catalog\Helper\Product::class)->getSkipSaleableCheck(); ?>
1512
<?php list($_defaultQty, $_canChangeQty) = $block->getDefaultValues(); ?>
1613

17-
<div class="field admin__field options<?php if ($_option->getRequired()) echo ' required' ?>">
14+
<div class="field admin__field options<?php if ($_option->getRequired()) { echo ' required'; } ?>">
1815
<label class="label admin__field-label"><span><?= $block->escapeHtml($_option->getTitle()) ?></span></label>
1916
<div class="control admin__field-control">
20-
<div class="nested<?php if ($_option->getDecoratedIsLast()):?> last<?php endif; ?>">
21-
<?php if ($block->showSingle()): ?>
17+
<div class="nested<?php if ($_option->getDecoratedIsLast()) :?> last<?php endif; ?>">
18+
<?php if ($block->showSingle()) : ?>
2219
<?= /* @noEscape */ $block->getSelectionTitlePrice($_selections[0]) ?>
2320
<input type="hidden"
2421
name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
2522
value="<?= $block->escapeHtmlAttr($_selections[0]->getSelectionId()) ?>"
2623
price="<?= $block->escapeHtmlAttr($block->getSelectionPrice($_selections[0])) ?>" />
27-
<?php else:?>
28-
<?php if (!$_option->getRequired()): ?>
24+
<?php else :?>
25+
<?php if (!$_option->getRequired()) : ?>
2926
<div class="field choice admin__field admin__field-option">
3027
<input type="radio"
3128
class="radio admin__control-radio"
@@ -38,14 +35,14 @@
3835
</div>
3936
<?php endif; ?>
4037

41-
<?php foreach ($_selections as $_selection): ?>
38+
<?php foreach ($_selections as $_selection) : ?>
4239
<div class="field choice admin__field admin__field-option">
4340
<input type="radio"
4441
class="radio admin__control-radio <?= $_option->getRequired() ? ' validate-one-required-by-name' : '' ?> change-container-classname"
4542
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"
4643
name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
47-
<?php if ($block->isSelected($_selection)) echo ' checked="checked"' ?>
48-
<?php if (!$_selection->isSaleable() && !$_skipSaleableCheck) echo ' disabled="disabled"' ?>
44+
<?php if ($block->isSelected($_selection)) { echo ' checked="checked"'; } ?>
45+
<?php if (!$_selection->isSaleable() && !$_skipSaleableCheck) { echo ' disabled="disabled"'; } ?>
4946
value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"
5047
onclick="ProductConfigure.bundleControl.changeSelection(this)"
5148
price="<?= $block->escapeHtmlAttr($block->getSelectionPrice($_selection)) ?>"
@@ -54,7 +51,7 @@
5451
for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>">
5552
<span><?= /* @noEscape */ $block->getSelectionTitlePrice($_selection) ?></span>
5653
</label>
57-
<?php if ($_option->getRequired()): ?>
54+
<?php if ($_option->getRequired()) : ?>
5855
<?= /* @noEscape */ $block->setValidationContainer('bundle-option-'.$_option->getId().'-'.$_selection->getSelectionId(), 'bundle-option-'.$_option->getId().'-container') ?>
5956
<?php endif; ?>
6057
</div>
@@ -66,9 +63,9 @@
6663
for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input">
6764
<span><?= $block->escapeHtml(__('Quantity:')) ?></span>
6865
</label>
69-
<div class="control admin__field-control"><input <?php if (!$_canChangeQty) echo ' disabled="disabled"' ?>
66+
<div class="control admin__field-control"><input <?php if (!$_canChangeQty) { echo ' disabled="disabled"'; } ?>
7067
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input"
71-
class="input-text admin__control-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>"
68+
class="input-text admin__control-text qty<?php if (!$_canChangeQty) { echo ' qty-disabled'; } ?>"
7269
type="text"
7370
name="bundle_option_qty[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
7471
value="<?= $block->escapeHtmlAttr($_defaultQty) ?>" />

app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/select.phtml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,34 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
?>
107
<?php /* @var $block \Magento\Bundle\Block\Adminhtml\Catalog\Product\Composite\Fieldset\Options\Type\Select */ ?>
118
<?php $_option = $block->getOption(); ?>
129
<?php $_selections = $_option->getSelections(); ?>
1310
<?php $_default = $_option->getDefaultSelection(); ?>
14-
<?php $_skipSaleableCheck = $this->helper('Magento\Catalog\Helper\Product')->getSkipSaleableCheck(); ?>
11+
<?php $_skipSaleableCheck = $this->helper(Magento\Catalog\Helper\Product::class)->getSkipSaleableCheck(); ?>
1512
<?php list($_defaultQty, $_canChangeQty) = $block->getDefaultValues(); ?>
1613

17-
<div class="field admin__field option<?php if ($_option->getDecoratedIsLast()):?> last<?php endif; ?><?php if ($_option->getRequired()) echo ' required _required' ?>">
14+
<div class="field admin__field option<?php if ($_option->getDecoratedIsLast()) :?> last<?php endif; ?><?php if ($_option->getRequired()) { echo ' required _required'; } ?>">
1815
<label class="label admin__field-label"><span><?= $block->escapeHtml($_option->getTitle()) ?></span></label>
1916
<div class="control admin__field-control">
20-
<?php if ($block->showSingle()): ?>
17+
<?php if ($block->showSingle()) : ?>
2118
<?= /* @noEscape */ $block->getSelectionTitlePrice($_selections[0]) ?>
2219
<input type="hidden"
2320
name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
2421
value="<?= $block->escapeHtmlAttr($_selections[0]->getSelectionId()) ?>"
2522
price="<?= $block->escapeHtmlAttr($block->getSelectionPrice($_selections[0])) ?>" />
26-
<?php else:?>
23+
<?php else :?>
2724
<select id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>"
2825
name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
29-
class="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?><?php if ($_option->getRequired()) echo ' required-entry' ?> select admin__control-select change-container-classname"
26+
class="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?><?php if ($_option->getRequired()) { echo ' required-entry'; } ?> select admin__control-select change-container-classname"
3027
onchange="ProductConfigure.bundleControl.changeSelection(this)">
3128
<option value=""><?= $block->escapeHtml(__('Choose a selection...')) ?></option>
32-
<?php foreach ($_selections as $_selection): ?>
29+
<?php foreach ($_selections as $_selection) : ?>
3330
<option
3431
value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"
35-
<?php if ($block->isSelected($_selection)) echo ' selected="selected"' ?>
36-
<?php if (!$_selection->isSaleable() && !$_skipSaleableCheck) echo ' disabled="disabled"' ?>
32+
<?php if ($block->isSelected($_selection)) { echo ' selected="selected"'; } ?>
33+
<?php if (!$_selection->isSaleable() && !$_skipSaleableCheck) { echo ' disabled="disabled"'; } ?>
3734
price="<?= $block->escapeHtmlAttr($block->getSelectionPrice($_selection)) ?>"
3835
qtyId="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input">
3936
<?= /* @noEscape */ $block->getSelectionTitlePrice($_selection, false) ?>
@@ -49,9 +46,9 @@
4946
<span><?= $block->escapeHtml(__('Quantity:')) ?></span>
5047
</label>
5148
<div class="control admin__field-control">
52-
<input <?php if (!$_canChangeQty) echo ' disabled="disabled"' ?>
49+
<input <?php if (!$_canChangeQty) { echo ' disabled="disabled"'; } ?>
5350
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input"
54-
class="input-text admin__control-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>"
51+
class="input-text admin__control-text qty<?php if (!$_canChangeQty) { echo ' qty-disabled'; } ?>"
5552
type="text"
5653
name="bundle_option_qty[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
5754
value="<?= $block->escapeHtmlAttr($_defaultQty) ?>" />

0 commit comments

Comments
 (0)