|
4 | 4 | * See COPYING.txt for license details.
|
5 | 5 | */
|
6 | 6 |
|
7 |
| -// @codingStandardsIgnoreFile |
| 7 | +// phpcs:disable PSR2.ControlStructures.SwitchDeclaration |
| 8 | +// phpcs:disable Generic.WhiteSpace.ScopeIndent |
8 | 9 |
|
9 | 10 | /** @var $block \Magento\Swatches\Block\LayeredNavigation\RenderLayered */
|
10 | 11 | ?>
|
11 | 12 | <?php $swatchData = $block->getSwatchData(); ?>
|
12 |
| -<div class="swatch-attribute swatch-layered <?= /* @escapeNotVerified */ $swatchData['attribute_code'] ?>" |
13 |
| - attribute-code="<?= /* @escapeNotVerified */ $swatchData['attribute_code'] ?>" |
14 |
| - attribute-id="<?= /* @escapeNotVerified */ $swatchData['attribute_id'] ?>"> |
| 13 | +<div class="swatch-attribute swatch-layered <?= $block->escapeHtmlAttr($swatchData['attribute_code']) ?>" |
| 14 | + attribute-code="<?= $block->escapeHtmlAttr($swatchData['attribute_code']) ?>" |
| 15 | + attribute-id="<?= $block->escapeHtmlAttr($swatchData['attribute_id']) ?>"> |
15 | 16 | <div class="swatch-attribute-options clearfix">
|
16 |
| - <?php foreach ($swatchData['options'] as $option => $label): ?> |
17 |
| - <a href="<?= /* @escapeNotVerified */ $label['link'] ?>" |
18 |
| - aria-label="<?= /* @escapeNotVerified */ $label['label'] ?>" |
| 17 | + <?php foreach ($swatchData['options'] as $option => $label) : ?> |
| 18 | + <a href="<?= $block->escapeUrl($label['link']) ?>" |
| 19 | + aria-label="<?= $block->escapeHtmlAttr($label['label']) ?>" |
19 | 20 | class="swatch-option-link-layered">
|
20 |
| - <?php if (isset($swatchData['swatches'][$option]['type'])): ?> |
| 21 | + <?php if (isset($swatchData['swatches'][$option]['type'])) : ?> |
21 | 22 | <?php switch ($swatchData['swatches'][$option]['type']) {
|
22 | 23 | case '3':
|
23 | 24 | ?>
|
24 |
| - <div class="swatch-option <?= /* @escapeNotVerified */ $label['custom_style'] ?>" |
| 25 | + <div class="swatch-option <?= $block->escapeHtmlAttr($label['custom_style']) ?>" |
25 | 26 | tabindex="-1"
|
26 | 27 | option-type="3"
|
27 |
| - option-id="<?= /* @escapeNotVerified */ $option ?>" |
28 |
| - option-label="<?= /* @escapeNotVerified */ $label['label'] ?>" |
| 28 | + option-id="<?= $block->escapeHtmlAttr($option) ?>" |
| 29 | + option-label="<?= $block->escapeHtmlAttr($label['label']) ?>" |
29 | 30 | option-tooltip-thumb=""
|
30 | 31 | option-tooltip-value=""
|
31 | 32 | ></div>
|
32 |
| - <?php break; |
| 33 | + <?php break; |
33 | 34 | case '2':
|
34 | 35 | ?>
|
35 | 36 | <?php $swatchThumbPath = $block->getSwatchPath('swatch_thumb', $swatchData['swatches'][$option]['value']); ?>
|
36 | 37 | <?php $swatchImagePath = $block->getSwatchPath('swatch_image', $swatchData['swatches'][$option]['value']); ?>
|
37 |
| - <div class="swatch-option image <?= /* @escapeNotVerified */ $label['custom_style'] ?>" |
| 38 | + <div class="swatch-option image <?= $block->escapeHtmlAttr($label['custom_style']) ?>" |
38 | 39 | tabindex="-1"
|
39 | 40 | option-type="2"
|
40 |
| - option-id="<?= /* @escapeNotVerified */ $option ?>" |
41 |
| - option-label="<?= /* @escapeNotVerified */ $label['label'] ?>" |
42 |
| - option-tooltip-thumb="<?= /* @escapeNotVerified */ $swatchThumbPath ?>" |
| 41 | + option-id="<?= $block->escapeHtmlAttr($option) ?>" |
| 42 | + option-label="<?= $block->escapeHtmlAttr($label['label']) ?>" |
| 43 | + option-tooltip-thumb="<?= $block->escapeUrl($swatchThumbPath) ?>" |
43 | 44 | option-tooltip-value=""
|
44 |
| - style="background: url(<?= /* @escapeNotVerified */ $swatchImagePath ?>) no-repeat center; background-size: initial;"></div> |
45 |
| - <?php break; |
| 45 | + style="background: url(<?= $block->escapeUrl($swatchImagePath) ?>) no-repeat center; background-size: initial;"></div> |
| 46 | + <?php break; |
46 | 47 | case '1':
|
47 | 48 | ?>
|
48 |
| - <div class="swatch-option color <?= /* @escapeNotVerified */ $label['custom_style'] ?>" |
| 49 | + <div class="swatch-option color <?= $block->escapeHtmlAttr($label['custom_style']) ?>" |
49 | 50 | tabindex="-1"
|
50 | 51 | option-type="1"
|
51 |
| - option-id="<?= /* @escapeNotVerified */ $option ?>" |
52 |
| - option-label="<?= /* @escapeNotVerified */ $label['label'] ?>" |
| 52 | + option-id="<?= $block->escapeHtmlAttr($option) ?>" |
| 53 | + option-label="<?= $block->escapeHtmlAttr($label['label']) ?>" |
53 | 54 | option-tooltip-thumb=""
|
54 |
| - option-tooltip-value="<?= /* @escapeNotVerified */ $swatchData['swatches'][$option]['value'] ?>" |
55 |
| - style="background: <?= /* @escapeNotVerified */ $swatchData['swatches'][$option]['value'] ?> no-repeat center; background-size: initial;"></div> |
56 |
| - <?php break; |
| 55 | + option-tooltip-value="<?= $block->escapeHtmlAttr($swatchData['swatches'][$option]['value']) ?>" |
| 56 | + style="background: <?= $block->escapeHtmlAttr($swatchData['swatches'][$option]['value']) ?> no-repeat center; background-size: initial;"></div> |
| 57 | + <?php break; |
57 | 58 | case '0':
|
58 | 59 | default:
|
59 | 60 | ?>
|
60 |
| - <div class="swatch-option text <?= /* @escapeNotVerified */ $label['custom_style'] ?>" |
61 |
| - tabindex="-1" |
62 |
| - option-type="0" |
63 |
| - option-id="<?= /* @escapeNotVerified */ $option ?>" |
64 |
| - option-label="<?= /* @escapeNotVerified */ $label['label'] ?>" |
65 |
| - option-tooltip-thumb="" |
66 |
| - option-tooltip-value="" |
67 |
| - ><?= /* @escapeNotVerified */ $swatchData['swatches'][$option]['value'] ?></div> |
68 |
| - <?php break; |
| 61 | + <div class="swatch-option text <?= $block->escapeHtmlAttr($label['custom_style']) ?>" |
| 62 | + tabindex="-1" |
| 63 | + option-type="0" |
| 64 | + option-id="<?= $block->escapeHtmlAttr($option) ?>" |
| 65 | + option-label="<?= $block->escapeHtmlAttr($label['label']) ?>" |
| 66 | + option-tooltip-thumb="" |
| 67 | + option-tooltip-value="" |
| 68 | + ><?= $block->escapeHtml($swatchData['swatches'][$option]['value']) ?></div> |
| 69 | + <?php break; |
69 | 70 | } ?>
|
70 | 71 | <?php endif; ?>
|
71 | 72 | </a>
|
|
75 | 76 |
|
76 | 77 | <script>
|
77 | 78 | require(["jquery", "jquery/ui", "Magento_Swatches/js/swatch-renderer"], function ($) {
|
78 |
| - $('.swatch-layered.<?= /* @escapeNotVerified */ $swatchData['attribute_code'] ?>') |
| 79 | + $('.swatch-layered.<?= $block->escapeJs($swatchData['attribute_code']) ?>') |
79 | 80 | .find('[option-type="1"], [option-type="2"], [option-type="0"], [option-type="3"]')
|
80 | 81 | .SwatchRendererTooltip();
|
81 | 82 | });
|
|
0 commit comments