Skip to content

Commit 7054f6e

Browse files
authored
ENGCOM-8309: Clean code and remove whitespace in markup layered navigation filters #30333
2 parents 9f4fd32 + e8bfc12 commit 7054f6e

File tree

1 file changed

+22
-21
lines changed
  • app/code/Magento/LayeredNavigation/view/frontend/templates/layer

1 file changed

+22
-21
lines changed

app/code/Magento/LayeredNavigation/view/frontend/templates/layer/filter.phtml

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

7-
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
87
?>
98
<?php
10-
/** @var $block \Magento\LayeredNavigation\Block\Navigation\FilterRenderer */
9+
/** @var \Magento\LayeredNavigation\Block\Navigation\FilterRenderer $block */
10+
/** @var \Magento\Framework\Escaper $escaper */
1111
/** @var \Magento\LayeredNavigation\ViewModel\Layer\Filter $viewModel */
1212
$viewModel = $block->getData('product_layer_view_model');
1313
?>
@@ -16,28 +16,29 @@ $viewModel = $block->getData('product_layer_view_model');
1616
<?php foreach ($filterItems as $filterItem): ?>
1717
<li class="item">
1818
<?php if ($filterItem->getCount() > 0): ?>
19-
<a href="<?= $block->escapeUrl($filterItem->getUrl()) ?>" rel="nofollow">
20-
<?= /* @noEscape */ $filterItem->getLabel() ?>
21-
<?php if ($viewModel->shouldDisplayProductCountOnLayer()): ?>
22-
<span class="count"><?= /* @noEscape */ (int)$filterItem->getCount() ?>
23-
<span class="filter-count-label">
24-
<?php if ($filterItem->getCount() == 1):
25-
?> <?= $block->escapeHtml(__('item')) ?><?php
19+
<a
20+
href="<?= $escaper->escapeUrl($filterItem->getUrl()) ?>"
21+
rel="nofollow"
22+
><?= /* @noEscape */ $filterItem->getLabel() ?><?php
23+
if ($viewModel->shouldDisplayProductCountOnLayer()): ?><span
24+
class="count"><?= /* @noEscape */ (int) $filterItem->getCount() ?><span
25+
class="filter-count-label"><?php
26+
if ($filterItem->getCount() == 1): ?>
27+
<?= $escaper->escapeHtml(__('item')) ?><?php
2628
else:
27-
?> <?= $block->escapeHtml(__('item')) ?><?php
29+
?><?= $escaper->escapeHtml(__('item')) ?><?php
2830
endif;?></span></span>
29-
<?php endif; ?>
30-
</a>
31+
<?php endif; ?></a>
3132
<?php else: ?>
32-
<?= /* @noEscape */ $filterItem->getLabel() ?>
33-
<?php if ($viewModel->shouldDisplayProductCountOnLayer()): ?>
34-
<span class="count"><?= /* @noEscape */ (int)$filterItem->getCount() ?>
35-
<span class="filter-count-label">
36-
<?php if ($filterItem->getCount() == 1):
37-
?><?= $block->escapeHtml(__('items')) ?><?php
38-
else:
39-
?><?= $block->escapeHtml(__('items')) ?><?php
40-
endif;?></span></span>
33+
<?= /* @noEscape */ $filterItem->getLabel() ?><?php
34+
if ($viewModel->shouldDisplayProductCountOnLayer()): ?><span
35+
class="count"><?= /* @noEscape */ (int) $filterItem->getCount() ?><span
36+
class="filter-count-label"><?php
37+
if ($filterItem->getCount() == 1): ?>
38+
<?= $escaper->escapeHtml(__('items')) ?><?php
39+
else:
40+
?><?= $escaper->escapeHtml(__('items')) ?><?php
41+
endif;?></span></span>
4142
<?php endif; ?>
4243
<?php endif; ?>
4344
</li>

0 commit comments

Comments
 (0)