<?php
/**
 * @author Amasty Team
 * @copyright Copyright (c) Amasty (https://www.amasty.com)
 * @package Jet Theme Backend for Magento 2 (System)
 */
/**
 * @var $block Amasty\JetTheme\Block\Widget\BannerCarousel
 * @var $escaper Magento\Framework\Escaper
 */

$images = $block->getImages();
?>

<ul class="amtheme-images-carousel amtheme-slick-slider"
    data-mage-init='{"slickSlider":{
        "sliderOptions": {
            "slidesToShow": 1,
            "slidesToScroll": 1,
            "infinite": true,
            "dots": true,
            "arrows": false
        }
    }}'>
    <?php foreach ($images as $image): ?>
        <li class="amtheme-slide">
            <?php if (!empty($image['link'])): ?>
                <a href="<?= $escaper->escapeUrl($image['link']) ?>" alt="<?= $escaper->escapeHtmlAttr($image['alt']) ?>">
                    <img class="amtheme-image"
                         src="<?= $escaper->escapeUrl($image['url']) ?>"
                         alt="<?= $escaper->escapeHtmlAttr($image['alt']) ?>">
                </a>
            <?php else: ?>
                <img class="amtheme-image"
                     src="<?= $escaper->escapeUrl($image['url']) ?>"
                     alt="<?= $escaper->escapeHtmlAttr($image['alt']) ?>">
            <?php endif; ?>
        </li>
    <?php endforeach; ?>
</ul>
