<?php
    /**
     * Copyright © 2017 Codazon, Inc. All rights reserved.
     * See COPYING.txt for license details.
     */
    
    // @codingStandardsIgnoreFile
    
    ?>
<?php
    /**
     * Currency switcher
     *
     * @see \Magento\Directory\Block\Currency
     */
    ?>

<?php $currencies = $block->getCurrencies(); ?>
<?php $currentCurrencyCode = $block->getCurrentCurrencyCode(); ?>
<?php $id = uniqid(); ?>
<div class="switcher currency switcher-currency -style-03" id="switcher-currency<?php echo $id?>">
    <div class="actions dropdown options switcher-options">
        <a class="action toggle switcher-trigger" id="switcher-currency-trigger<?php echo $id?>"> 
            <span class="language-<?php echo $block->escapeHtml($block->getCurrentCurrencyCode()) ?> text">
                <span class="code"><?php echo $block->escapeHtml($currentCurrencyCode) ?></span><span  class="name"><?php echo @$block->escapeHtml($currencies[$currentCurrencyCode]) ?></span>
            </span>
        </a>
        <?php if ($block->getCurrencyCount() > 1): ?>
        <ul class="dropdown switcher-dropdown" data-mage-init='{"dropdownDialog":{
            "appendTo":"#switcher-currency<?php echo $id?> > .options",
            "triggerTarget":"#switcher-currency-trigger<?php echo $id?>",
            "closeOnMouseLeave": false,
            "triggerClass":"active",
            "parentClass":"active",
            "buttons":null}}'
            >
            <?php foreach ($currencies as $_code => $_name): ?>
            <?php if ($_code != $currentCurrencyCode): ?>
            <li class="currency-<?php echo $_code ?> switcher-option">
                <a href="#" data-post='<?php echo $block->getSwitchCurrencyPostData($_code); ?>'><?php echo $_code ?> - <?php echo $_name ?></a>
            </li>
            <?php endif; ?>
            <?php endforeach; ?>
        </ul>
        <?php endif; ?>
    </div>
</div>