<?php
/**
 * @author Amasty Team
 * @copyright Copyright (c) Amasty (https://www.amasty.com)
 * @package Blog Pro for Magento 2
 */
/**
 * Amasty Currency switcher for AMP
 *
 * @var \Amasty\Blog\Block\Amp\Currency $block
 */
?>

<?php if ($block->getCurrencyCount() > 1): ?>
    <?php $currencies = $block->getCurrencies(); ?>
    <?php $currentCurrencyCode = $block->getCurrentCurrencyCode(); ?>
    <?php $id = $block->getIdModifier() ? '-' . $block->getIdModifier() : '' ?>
    <div id="switcher-currency<?= $block->escapeHtmlAttr($id) ?>" class="switcher currency switcher-currency amblog-amp-navigation">
        <p class="label switcher-label amblog-amp-title">
            <strong>
                <?= $block->escapeHtml(__('Currency')) ?>
            </strong>
        </p>
        <amp-accordion animate class="switcher-options">
            <section>
                <h3 id="language-<?= $block->escapeHtml($block->getCurrentCurrencyCode()) ?>"
                    class="amblog-amp-title view-<?= $block->escapeHtml($block->getCurrentStoreCode()) ?>">
                    <?= $block->escapeHtml($currentCurrencyCode) ?> - <?= $currencies[$currentCurrencyCode] ? $block->escapeHtml($currencies[$currentCurrencyCode]) : '' ?>
                    <i class="fas fa-angle-down icon"></i>
                </h3>
                <ul class="dropdown switcher-dropdown links amblog-amp-submenu">
                    <?php foreach ($currencies as $code => $name): ?>
                        <?php if ($code != $currentCurrencyCode): ?>
                            <li class="store currency-<?= $block->escapeHtmlAttr($code) ?> switcher-option">
                                <a href="<?= $block->escapeUrl($block->getStoreUrlAmp($code)) ?>">
                                    <?= $block->escapeHtml($code) ?> - <?= $block->escapeHtml($name) ?>
                                </a>
                            </li>
                        <?php endif; ?>
                    <?php endforeach; ?>
                </ul>
            </section>
        </amp-accordion>
    </div>
<?php endif; ?>
