Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit 6e4e0c9d authored by Nicolas's avatar Nicolas
Browse files

Modification du template

parent abf8820f
No related branches found
No related tags found
No related merge requests found
<?php
use \NicolasBejean\ImageSliderManager\Block\Widget\ImageSlider;
use \Magento\Framework\Exception\LocalizedException;
try {
/** @var ImageSlider $block */
$active = $block->isActive();
$activeTitle = $block->getActiveTitle();
$activeContent = $block->getActiveContent();
$activeWrapper = $block->getActiveImageWrapper();
$activeLink = $block->getActiveLink();
/** @var ImageSlider $block */
$slider = $block->getSlider();
$sliderContent = $block->getSliderContent($slider->getContent());
$active = $slider->isActive();
$activeTitle = $block->getActiveTitle();
$activeContent = $block->getActiveContent();
$activeWrapper = $block->getActiveImageWrapper();
$activeLink = $block->getActiveLink();
$sliderContent = $block->getSlider();
} catch (LocalizedException $e) {
$active = false;
if ($active) {
$imageCollection = [];
$iteration = 0;
foreach ($sliderContent as $image) {
if ($image['is_active']) {
$imageCollection[$iteration]['path'] = $block->getResizeImage($image['path'], $block->getWidth(), $block->getHeight());
$imageCollection[$iteration]['width'] = $block->getResizedImageWidth($imageCollection[$iteration]['path']);
$imageCollection[$iteration]['height'] = $block->getResizedImageHeight($imageCollection[$iteration]['path']);
$imageCollection[$iteration]['alt'] = $image['alt'];
}
$iteration++;
}
}
?>
<?php if ($active): ?>
<?php if ($activeWrapper): ?>
<div class="widget block block-static-block imageslidermanager <?php if ($block->getWrapperCssClasses()): ?><?= /* @noEscape */ $block->getWrapperCssClasses(); ?><?php endif; ?>">
<div class="imageslidermanager <?php if ($block->getWrapperCssClasses()): ?><?= /* @noEscape */ $block->getWrapperCssClasses(); ?><?php endif; ?>">
<?php endif; ?>
<?php if ($activeTitle || $activeContent): ?>
<div class="imageslidermanager-title-content <?php if ($block->getWidgetTitleCSS()): ?><?= /* @noEscape */ $block->getWidgetTitleCSS(); ?><?php endif; ?>">
......@@ -36,19 +46,24 @@ try {
<a href="<?= /* @noEscape */ $block->getLinkHref(); ?>" target="<?= /* @noEscape */ $block->getLinkTarget(); ?>">
<?php endif; ?>
<div class="imageslidermanager-imageslider glide hero">
<div class="imageslidermanager-imageslider glide hero" style="width: <?= /* @noEscape */ $block->getWidth(); ?>px; height: <?= /* @noEscape */ $block->getHeight(); ?>px;">
<div class="glide__track" data-glide-el="track">
<ul class="glide__slides">
<?php foreach ($sliderContent as $image) : ?>
<?php foreach ($imageCollection as $image) : ?>
<li class="glide__slide">
<img src="<?php echo /* @noEscape */ $block->getResizeImage($image['path']); ?>"
<img src="<?php echo /* @noEscape */ $image['path']; ?>"
<?php if ($block->getCssClasses()): ?>class="<?= /* @noEscape */ $block->getCssClasses(); ?>"<?php endif; ?>
alt="<?= /* @noEscape */ $image['alt']; ?>"
<?php if ($block->getExtraCss()): ?>style="<?= /* @noEscape */ $block->getExtraCss(); ?>"<?php endif; ?>
<?php if ($block->getDataBind()): ?>data-bind="<?= /* @noEscape */ $block->getDataBind(); ?>"<?php endif; ?>
width="<?= /* @noEscape */ $image['width']; ?>"
height="<?= /* @noEscape */ $image['height']; ?>"
/>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php if(count($sliderContent) > 1): ?>
<?php if (count($sliderContent) > 1): ?>
<div class="glide__arrows" data-glide-el="controls">
<button class="glide__arrow glide__arrow--prev" data-glide-dir="<">prev</button>
<button class="glide__arrow glide__arrow--next" data-glide-dir=">">next</button>
......@@ -62,11 +77,11 @@ try {
<?php if ($activeWrapper): ?>
</div>
<?php endif; ?>
<?php if(count($sliderContent) > 1): ?>
<?php if (count($sliderContent) > 1): ?>
<script>
require(['jquery', 'NicolasBejean_ImageSliderManager/js/glide', 'domReady!'], function($, Glide){
new Glide('.glide').mount();
});
</script>
<?php endif; ?>
<?php endif; ?>
\ No newline at end of file
<?php endif; ?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment