<?php
/**
 * Copyright © Codazon, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
?>
<?php if ($crumbs && is_array($crumbs)) : ?>
<?php
$ampHelper = $this->helper(\Codazon\GoogleAmpManager\Helper\Data::class);
?>
<div class="breadcrumbs">
    <ul class="items">
        <?php foreach ($crumbs as $crumbName => $crumbInfo) : ?>
            <li class="item <?= $block->escapeHtmlAttr($crumbName) ?>">
            <?php if ($crumbInfo['link']) : ?>
                <a href="<?= $ampHelper->transformToAmpUrl($block->escapeUrl($crumbInfo['link'])) ?>"
                   title="<?= $block->escapeHtmlAttr($crumbInfo['title']) ?>">
                    <?= $block->escapeHtml($crumbInfo['label']) ?>
                </a>
            <?php elseif ($crumbInfo['last']) : ?>
                <strong><?= $block->escapeHtml($crumbInfo['label']) ?></strong>
            <?php else : ?>
                <?= $block->escapeHtml($crumbInfo['label']) ?>
            <?php endif; ?>
            </li>
        <?php endforeach; ?>
    </ul>
</div>
<?php endif; ?>
