101 lines
4.5 KiB
PHTML
101 lines
4.5 KiB
PHTML
<?php
|
|
|
|
/**
|
|
* @var \Esun\Homepage\Block\CreateAnything $block
|
|
* @var \Magento\Framework\Escaper $escaper
|
|
*/
|
|
|
|
$items = $block->getItems();
|
|
if (!$items) {
|
|
return;
|
|
}
|
|
|
|
$hasNavigation = count($items) > 4;
|
|
?>
|
|
<section class="esun-create-anything" aria-labelledby="esun-create-anything-title">
|
|
<h2 class="esun-create-anything__heading typo-section-title" id="esun-create-anything-title">
|
|
<?= $escaper->escapeHtml(__('Create Anything You Imagine')) ?>
|
|
</h2>
|
|
|
|
<div class="esun-create-anything__slider swiper-container"
|
|
data-role="esun-create-anything-slider"
|
|
data-has-navigation="<?= $hasNavigation ? 'true' : 'false' ?>">
|
|
<div class="swiper-wrapper">
|
|
<?php foreach ($items as $item): ?>
|
|
<?php /** @var \Magento\Catalog\Model\Product $product */ ?>
|
|
<?php $product = $item['product']; ?>
|
|
<article class="esun-create-anything__slide swiper-slide">
|
|
<div class="esun-create-anything__media"
|
|
data-role="esun-create-anything-video"
|
|
data-video-url="<?= $escaper->escapeUrl($item['video_url']) ?>">
|
|
<?php if ($item['cover_url']): ?>
|
|
<img class="esun-create-anything__cover"
|
|
src="<?= $escaper->escapeUrl($item['cover_url']) ?>"
|
|
alt="<?= $escaper->escapeHtmlAttr($item['title']) ?>">
|
|
<?php endif; ?>
|
|
<video class="esun-create-anything__video"
|
|
muted
|
|
playsinline
|
|
preload="auto"
|
|
src="<?= $escaper->escapeUrl($item['video_url']) ?>"></video>
|
|
|
|
<div class="esun-create-anything__copy">
|
|
<h3><?= $escaper->escapeHtml($item['title']) ?></h3>
|
|
<?php if ($item['subtitle']): ?>
|
|
<p><?= $escaper->escapeHtml($item['subtitle']) ?></p>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<a class="esun-create-anything__product"
|
|
href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>">
|
|
<span class="esun-create-anything__product-image">
|
|
<?= /* @noEscape */ $block->getImage($product, 'category_page_grid')->toHtml() ?>
|
|
</span>
|
|
<span class="esun-create-anything__product-copy">
|
|
<strong><?= $escaper->escapeHtml($product->getName()) ?></strong>
|
|
<span class="esun-create-anything__price">
|
|
<span class="esun-create-anything__final-price">
|
|
<?= $escaper->escapeHtml($block->getFormattedFinalPrice($product)) ?>
|
|
</span>
|
|
<?php if ($block->hasRegularPrice($product)): ?>
|
|
<span class="esun-create-anything__regular-price">
|
|
<?= $escaper->escapeHtml($block->getFormattedRegularPrice($product)) ?>
|
|
</span>
|
|
<?php endif; ?>
|
|
</span>
|
|
</span>
|
|
</a>
|
|
</div>
|
|
</article>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
|
|
<?php if ($hasNavigation): ?>
|
|
<div class="esun-create-anything__controls">
|
|
<button class="esun-create-anything__previous"
|
|
type="button"
|
|
aria-label="<?= $escaper->escapeHtmlAttr(__('Previous')) ?>">
|
|
<span aria-hidden="true">‹</span>
|
|
</button>
|
|
<div class="esun-create-anything__pagination swiper-pagination"></div>
|
|
<button class="esun-create-anything__next"
|
|
type="button"
|
|
aria-label="<?= $escaper->escapeHtmlAttr(__('Next')) ?>">
|
|
<span aria-hidden="true">›</span>
|
|
</button>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</section>
|
|
|
|
<script type="text/x-magento-init">
|
|
{
|
|
"[data-role=esun-create-anything-slider]": {
|
|
"Esun_Homepage/js/create-anything": {}
|
|
},
|
|
"[data-role=esun-create-anything-video]": {
|
|
"Esun_Homepage/js/video-hover": {}
|
|
}
|
|
}
|
|
</script>
|