Skip to content

Clean code and remove whitespace in markup layered navigation filters #30333

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

Merged
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,10 +4,10 @@
* See COPYING.txt for license details.
*/

// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
?>
<?php
/** @var $block \Magento\LayeredNavigation\Block\Navigation\FilterRenderer */
/** @var \Magento\LayeredNavigation\Block\Navigation\FilterRenderer $block */
/** @var \Magento\Framework\Escaper $escaper */
/** @var \Magento\LayeredNavigation\ViewModel\Layer\Filter $viewModel */
$viewModel = $block->getData('product_layer_view_model');
?>
Expand All @@ -16,28 +16,29 @@ $viewModel = $block->getData('product_layer_view_model');
<?php foreach ($filterItems as $filterItem): ?>
<li class="item">
<?php if ($filterItem->getCount() > 0): ?>
<a href="<?= $block->escapeUrl($filterItem->getUrl()) ?>" rel="nofollow">
<?= /* @noEscape */ $filterItem->getLabel() ?>
<?php if ($viewModel->shouldDisplayProductCountOnLayer()): ?>
<span class="count"><?= /* @noEscape */ (int)$filterItem->getCount() ?>
<span class="filter-count-label">
<?php if ($filterItem->getCount() == 1):
?> <?= $block->escapeHtml(__('item')) ?><?php
<a
href="<?= $escaper->escapeUrl($filterItem->getUrl()) ?>"
rel="nofollow"
><?= /* @noEscape */ $filterItem->getLabel() ?><?php
if ($viewModel->shouldDisplayProductCountOnLayer()): ?><span
class="count"><?= /* @noEscape */ (int) $filterItem->getCount() ?><span
class="filter-count-label"><?php
if ($filterItem->getCount() == 1): ?>
<?= $escaper->escapeHtml(__('item')) ?><?php
else:
?> <?= $block->escapeHtml(__('item')) ?><?php
?><?= $escaper->escapeHtml(__('item')) ?><?php
endif;?></span></span>
<?php endif; ?>
</a>
<?php endif; ?></a>
<?php else: ?>
<?= /* @noEscape */ $filterItem->getLabel() ?>
<?php if ($viewModel->shouldDisplayProductCountOnLayer()): ?>
<span class="count"><?= /* @noEscape */ (int)$filterItem->getCount() ?>
<span class="filter-count-label">
<?php if ($filterItem->getCount() == 1):
?><?= $block->escapeHtml(__('items')) ?><?php
else:
?><?= $block->escapeHtml(__('items')) ?><?php
endif;?></span></span>
<?= /* @noEscape */ $filterItem->getLabel() ?><?php
if ($viewModel->shouldDisplayProductCountOnLayer()): ?><span
class="count"><?= /* @noEscape */ (int) $filterItem->getCount() ?><span
class="filter-count-label"><?php
if ($filterItem->getCount() == 1): ?>
<?= $escaper->escapeHtml(__('items')) ?><?php
else:
?><?= $escaper->escapeHtml(__('items')) ?><?php
endif;?></span></span>
<?php endif; ?>
<?php endif; ?>
</li>
Expand Down