<?php
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>
<?php
/**
 * Product list toolbar
 *
 * @var $block \Magento\Catalog\Block\Product\ProductList\Toolbar
 */
use Magento\Catalog\Model\Product\ProductList\Toolbar;

$classIconList = "ti-view-list-alt";
$classIcon = "ti-layout-grid3";
?>
<?php if ($block->isEnabledViewSwitcher()): ?>
<div class="modes">
    <?php $_modes = $block->getModes(); ?>
    <?php if ($_modes && count($_modes) > 1): ?>
    <strong class="modes-label" id="modes-label"><?php /* @escapeNotVerified */ echo __('View as') ?></strong>
    <?php foreach ($block->getModes() as $_code => $_label): ?>
        <?php if ($block->isModeActive($_code)): ?>
            <strong title="<?php /* @escapeNotVerified */ echo $_label ?>"
                class="modes-mode active mode-<?php /* @escapeNotVerified */ echo strtolower($_code); ?>"
                data-value="<?php /* @escapeNotVerified */ echo strtolower($_code); ?>">

                <?php 
                  if (strtolower($_code) == 'list'):
                    $classIcon = $classIconList;
                  endif;
                ?>

                <span class="<?php echo $classIcon; ?>">
                  <span><?php /* @escapeNotVerified */ echo $_label ?></span>
                </span>
            </strong>
        <?php else: ?>
            <a class="modes-mode mode-<?php /* @escapeNotVerified */ echo strtolower($_code); ?>"
                title="<?php /* @escapeNotVerified */ echo $_label ?>"
                href="#"
                data-role="mode-switcher"
                data-value="<?php /* @escapeNotVerified */ echo strtolower($_code); ?>"
                id="mode-<?php /* @escapeNotVerified */ echo strtolower($_code); ?>"
                aria-labelledby="modes-label mode-<?php /* @escapeNotVerified */ echo strtolower($_code); ?>">

                <?php 
                  if (strtolower($_code) == 'list'):
                    $classIcon = $classIconList;
                  endif;
                ?>

                <span class="<?php echo $classIcon; ?>">
                  <span><?php /* @escapeNotVerified */ echo $_label ?></span>
                </span>
            </a>
            <?php endif; ?>
        <?php endforeach; ?>
    <?php endif; ?>
</div>
<?php endif; ?>
