This repository has been archived by the owner on Apr 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
mod_uk_slider.php
53 lines (46 loc) · 1.8 KB
/
mod_uk_slider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php defined('_JEXEC') or die;
/*
* @package mod_uk_slider
* @copyright Copyright (C) 2019 Aleksey A. Morozov (AlekVolsk). All rights reserved.
* @license GNU General Public License version 3 or later; see http://www.gnu.org/licenses/gpl-3.0.txt
*/
use Joomla\CMS\Helper\ModuleHelper;
$vars = [
'slider_class', 'item_class', 'dotnav', 'slidenav',
'velocity', 'autoplay', 'autoplay_interval', 'finite', 'pause_on_hover', 'index', 'center', 'sets',
'grid', 'grid_divider', 'cols', 'cols_all', 'cols_s', 'cols_m', 'cols_l', 'cols_xl',
'items'
];
foreach ($vars as $var) {
$$var = $params->get($var);
}
$slider_class = trim($slider_class) ? ' ' . trim($slider_class) : '';
$item_class = trim($item_class);
$sw_params = [];
if ((int)$velocity > 1) $sw_params[] = 'velocity:' . (int)$velocity;
if ($autoplay) {
$sw_params[] = 'autoplay:true';
if ((int)$autoplay_interval != 7000 && (int)$autoplay_interval > 0) $sw_params[] = 'autoplay_interval:' . (int)$autoplay_interval;
}
if ($finite) $sw_params[] = 'finite:true';
if ($pause_on_hover) $sw_params[] = 'pause-on-hover:true';
if ((int)$index > 0) $sw_params[] = 'index:' . (int)$index;
if ((int)$center > 0) $sw_params[] = 'center:true';
if ((int)$sets > 0) $sw_params[] = 'sets:true';
$sw_params = $sw_params ? '="' . implode(';', $sw_params) . '"' : '';
$classes = [];
if ($grid != '') {
$classes[] = $grid;
if ((int)$grid_divider) $classes[] = 'uk-grid-divider';
}
if ((int)$cols) {
$classes[] = $cols_all;
$classes[] = $cols_s;
$classes[] = $cols_m;
$classes[] = $cols_l;
$classes[] = $cols_xl;
}
$classes = $classes ? ' ' . implode(' ', $classes) : '';
if ($items) {
require(ModuleHelper::getLayoutPath('mod_uk_slider', $params->get('layout', 'default')));
}