Initial commit: is_imageslider out of the box. v2.3.2

This commit is contained in:
Isabelle Anno
2025-11-19 13:30:22 +01:00
commit 2f4716f567
100 changed files with 8635 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
<?php
declare(strict_types=1);
namespace Oksydan\IsImageslider\Hook;
class DisplayHome extends AbstractCacheableDisplayHook
{
private const TEMPLATE_FILE = 'slider.tpl';
protected function getTemplate(): string
{
return DisplayHome::TEMPLATE_FILE;
}
protected function assignTemplateVariables(array $params)
{
$this->context->smarty->assign([
'homeslider' => [
'slides' => $this->getSlides(),
'speed' => $this->sliderConfiguration->getSliderSpeed(),
'pause' => $this->sliderConfiguration->getSliderPauseOnHover(),
'wrap' => $this->sliderConfiguration->getSliderWrap(),
],
]);
}
/**
* @return array
*/
private function getSlides(): array
{
$now = new \DateTime();
$slides = $this->slideRepository->getActiveSliderByLandAndStoreId(
$this->context->language->id,
$this->context->shop->id,
true,
0, // 0 means no limit
$now
);
foreach ($slides as &$slide) {
$slide = $this->slidePresenter->present($slide);
}
return $slides;
}
protected function getCacheKey(): string
{
return parent::getCacheKey() . '_' . ($this->context->isMobile() ? 'mobile' : 'desktop');
}
}