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

// @codingStandardsIgnoreFile

?>
<?php
/**
 * Language switcher template
 */
?>

<?php if (count($block->getStores())>1): ?>
<?php $id = $block->getIdModifier() ? '-' . $block->getIdModifier() : ''?>
<div class="switcher language switcher-language" data-ui-id="mobile-language-switcher" id="mobile-switcher-language<?php echo $id?>">
    <strong class="label switcher-label"><span><?php echo __('Language') ?></span></strong>
    <div class="actions dropdown options switcher-options">
        <div class="action toggle switcher-trigger" id="mobile-switcher-language-trigger<?php echo $id?>">
            <strong class="view-<?php echo $block->escapeHtml($block->getCurrentStoreCode()) ?>">
                <span><?php echo $block->escapeHtml($block->getStoreName()) ?></span>
            </strong>
        </div>
        <ul class="dropdown switcher-dropdown"
            data-mage-init='{"dropdownDialog":{
                "appendTo":"#mobile-switcher-language<?php echo $id ?> > .options",
                "triggerTarget":"#mobile-switcher-language-trigger<?php echo $id ?>",
                "closeOnMouseLeave": false,
                "triggerClass":"active",
                "parentClass":"active",
                "buttons":null}}'>
            <?php foreach ($block->getStores() as $_lang): ?>
                <?php if ($_lang->getId() != $block->getCurrentStoreId()): ?>
                    <li class="view-<?php echo $block->escapeHtml($_lang->getCode()); ?> switcher-option">
                        <a href="#" data-post='<?php echo $block->getTargetStorePostData($_lang); ?>'>
                            <?php echo $block->escapeHtml($_lang->getName()) ?></a>
                    </li>
                <?php endif; ?>
            <?php endforeach; ?>
        </ul>
    </div>
</div>
<?php endif; ?>
