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

// @codingStandardsIgnoreFile

?>
<?php
/**
 * Store switcher template
 *
 * @see \Magento\Store\Block\Store\Switcher
 */
?>
<?php if (count($block->getGroups())>1): ?>
<?php $id = $block->getIdModifier() ? '-' . $block->getIdModifier() : uniqid() ?>
<div class="switcher store switcher-store" id="switcher-store<?php /* @escapeNotVerified */ echo $id?>">
    <div class="actions dropdown options switcher-options">
        <?php foreach ($block->getGroups() as $_group): ?>
        <?php if ($_group->getId() == $block->getCurrentGroupId()): ?>
            <a class="action toggle switcher-trigger" href="#" id="switcher-store-trigger<?php /* @escapeNotVerified */ echo $id?>">
                <span><?php echo $block->escapeHtml($_group->getName()) ?></span>
            </a>
            <?php break ?>
        <?php endif; ?>
        <?php endforeach; ?>
        <ul class="dropdown switcher-dropdown"
            data-mage-init='{"dropdownDialog":{
                "appendTo":"#switcher-store<?php /* @escapeNotVerified */ echo $id?> > .options",
                "triggerTarget":"#switcher-store-trigger<?php /* @escapeNotVerified */ echo $id ?>",
                "closeOnMouseLeave": false,
                "triggerClass":"active",
                "parentClass":"active",
                "buttons":null}}'>
            <?php foreach ($block->getGroups() as $_group): ?>
            <?php if (!($_group->getId() == $block->getCurrentGroupId())): ?>
                <li class="switcher-option">
                    <a href="#"
                       data-post='<?php /* @escapeNotVerified */ echo $block->getTargetStorePostData($_group->getDefaultStore()); ?>'>
                        <?php echo $block->escapeHtml($_group->getName()) ?>
                    </a>
                </li>
            <?php endif; ?>
            <?php endforeach; ?>
        </ul>
    </div>
</div>
<?php endif; ?>
