<?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile
?>
<?php
/**
 * Category layered navigation state
 *
 * @var $block \Magento\LayeredNavigation\Block\Navigation\State
 */
?>
<?php $_filters = $block->getActiveFilters() ?>
<?php if (!empty($_filters)): ?>
<div class="filter-current" data-mage-init='{"collapsible":{"openedState": "active", "collapsible": true, "active": false }}'>
    <strong class="block-subtitle filter-current-subtitle"
            role="heading"
            aria-level="2"
            data-role="title"
            data-count="<?php echo count($_filters); ?>"><?php /* @escapeNotVerified */ echo __('CURRENTLY SHOPPING BY:') ?></strong>
    <ol class="items">
        <?php foreach ($_filters as $_filter): ?>
            <li class="item">
                <span class="filter-label"><?php echo $block->escapeHtml(__($_filter->getName())); ?></span>
                <span class="filter-value"><?php /* @escapeNotVerified */ echo $block->stripTags($_filter->getLabel()) ?></span>
                <?php
                $clearLinkUrl = $_filter->getClearLinkUrl();
                $currentFilterName = $block->escapeHtml(__($_filter->getName())) . " " . $block->stripTags($_filter->getLabel());
                if ($clearLinkUrl):
                    ?>
                    <a class="action previous" href="<?php /* @escapeNotVerified */ echo $_filter->getRemoveUrl() ?>"
                       title="<?php /* @escapeNotVerified */ echo __('Previous') ?>">
                        <span><?php /* @escapeNotVerified */ echo __('Previous') ?></span>
                    </a>
                    <a class="action remove"
                       title="<?php echo $block->escapeHtml($_filter->getFilter()->getClearLinkText()) ?>"
                       href="<?php /* @escapeNotVerified */ echo $clearLinkUrl ?>">
                        <span><?php echo $block->escapeHtml($_filter->getFilter()->getClearLinkText()) ?></span>
                    </a>
                <?php else: ?>
                    <a class="action remove" href="<?php /* @escapeNotVerified */ echo $_filter->getRemoveUrl() ?>"
                       title="<?php /* @escapeNotVerified */ echo $block->escapeHtml(__('Remove')) . " " . $currentFilterName;?>">
                        <span><?php /* @escapeNotVerified */ echo __('Remove This Item') ?></span>
                    </a>
                <?php endif; ?>
            </li>
        <?php endforeach; ?>
    </ol>
</div>
<?php endif; ?>
