<?php $helper = $this->helper('\Magento\Catalog\Helper\Data'); ?>
<ol class="items">
    <?php foreach ($filterItems as $filterItem): ?>
        <?php
            $checked = ''; 
            if(!$filterItem->getActive()) {
                $url = $filterItem->getUrl();
            } else {
                $checked = 'checked';
                $url = $filterItem->getRemoveUrl();
            }
             
        ?>
        <li class="item">
            <a class="mgs-ajax-layer-item" href="<?php echo $block->escapeUrl($url) ?>">
                <?php /* @escapeNotVerified */ echo $filterItem->getLabel() ?>
                <?php if (!$filterItem->getActive() && $filterItem->getCount() > 0): ?>
                    <span class="count mgs-option-count">
                    <?php /* @escapeNotVerified */ echo  $filterItem->getCount().' ' ?></span>
                <?php endif; ?>
            </a>
        </li>
    <?php endforeach ?>
</ol>
