init
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* @var \Esun\Homepage\Block\InnovativeMaterials $block
|
||||
* @var \Magento\Framework\Escaper $escaper
|
||||
*/
|
||||
|
||||
$items = $block->getItems();
|
||||
if (!$items) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<section class="esun-innovative-materials" aria-labelledby="esun-innovative-materials-title">
|
||||
<div class="esun-innovative-materials__inner">
|
||||
<h2 id="esun-innovative-materials-title">
|
||||
<?= $escaper->escapeHtml(__('Innovative Materials,')) ?><br>
|
||||
<?= $escaper->escapeHtml(__('Creative Life')) ?>
|
||||
</h2>
|
||||
|
||||
<div class="esun-innovative-materials__items"
|
||||
data-role="esun-innovative-materials-items">
|
||||
<?php foreach ($items as $item): ?>
|
||||
<?php
|
||||
$thumbnailUrl = trim((string) $item['thumbnail_url']);
|
||||
$imageUrl = trim((string) $item['image_url']);
|
||||
$hasHoverImage = $imageUrl !== '';
|
||||
?>
|
||||
<?php if ($thumbnailUrl): ?>
|
||||
<article class="esun-innovative-materials__item<?= $hasHoverImage
|
||||
? ' esun-innovative-materials__item--interactive'
|
||||
: '' ?>"
|
||||
<?= $hasHoverImage ? 'tabindex="0"' : '' ?>>
|
||||
<img class="esun-innovative-materials__thumbnail"
|
||||
src="<?= $escaper->escapeUrl($thumbnailUrl) ?>"
|
||||
alt="<?= $escaper->escapeHtmlAttr($item['title']) ?>">
|
||||
<?php if ($hasHoverImage): ?>
|
||||
<img class="esun-innovative-materials__hover-image"
|
||||
src="<?= $escaper->escapeUrl($imageUrl) ?>"
|
||||
alt="<?= $escaper->escapeHtmlAttr($item['title']) ?>">
|
||||
<?php endif; ?>
|
||||
</article>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script type="text/x-magento-init">
|
||||
{
|
||||
"[data-role=esun-innovative-materials-items]": {
|
||||
"Esun_Homepage/js/innovative-materials": {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user