1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* |
4
|
|
|
* @package sitemaker |
5
|
|
|
* @copyright (c) 2018 Daniel A. (blitze) |
6
|
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 |
7
|
|
|
* |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace blitze\content\blocks; |
11
|
|
|
|
12
|
|
|
class swiper extends recent |
13
|
|
|
{ |
14
|
|
|
/** @var \blitze\sitemaker\services\util */ |
|
|
|
|
15
|
|
|
protected $util; |
16
|
|
|
|
17
|
|
|
/** @var string */ |
18
|
|
|
protected $tpl_name = 'swiper'; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Constructor |
22
|
|
|
* |
23
|
|
|
* @param \phpbb\config\db $config Config object |
24
|
|
|
* @param \phpbb\language\language $language Language Object |
25
|
|
|
* @param \blitze\content\services\types $content_types Content types object |
26
|
|
|
* @param \blitze\content\services\fields $fields Content fields object |
27
|
|
|
* @param \blitze\sitemaker\services\date_range $date_range Date Range Object |
28
|
|
|
* @param \blitze\sitemaker\services\forum\data $forum Forum Data object |
29
|
|
|
* @param \blitze\sitemaker\services\util $util Sitemaker utility object |
30
|
|
|
*/ |
31
|
|
|
public function __construct(\phpbb\config\db $config, \phpbb\language\language $language, \blitze\content\services\types $content_types, \blitze\content\services\fields $fields, \blitze\sitemaker\services\date_range $date_range, \blitze\sitemaker\services\forum\data $forum, \blitze\sitemaker\services\util $util) |
|
|
|
|
32
|
|
|
{ |
33
|
|
|
parent::__construct($config, $language, $content_types, $fields, $date_range, $forum); |
34
|
|
|
|
35
|
|
|
$this->util = $util; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* {@inheritdoc} |
40
|
|
|
*/ |
41
|
|
|
public function get_config(array $settings) |
42
|
|
|
{ |
43
|
|
|
$config = parent::get_config($settings); |
44
|
|
|
|
45
|
|
|
$direction_options = array('horizontal' => 'SWIPER_DIRECTION_HORIZONTAL', 'vertical' => 'SWIPER_DIRECTION_VERTICAL'); |
46
|
|
|
$effect_options = array('slide' => 'SWIPER_EFFECT_SLIDE', 'fade' => 'SWIPER_EFFECT_FADE', 'coverflow' => 'SWIPER_EFFECT_COVERFLOW', 'flip' => 'SWIPER_EFFECT_FLIP'); |
47
|
|
|
$pagination_options = array('' => 'SWIPER_PAGINATION_NONE', 'bullets' => 'SWIPER_PAGINATION_BULLETS', 'fraction' => 'SWIPER_PAGINATION_FRACTION', 'progressbar' => 'SWIPER_PAGINATION_PROGRESSBAR'); |
48
|
|
|
$theme_options = array('default' => 'SWIPER_THEME_DEFAULT', 'white' => 'SWIPER_THEME_WHITE', 'black' => 'SWIPER_THEME_BLACK'); |
49
|
|
|
$text_pos_options = array('top' => 'SWIPER_TEXT_POSITION_TOP', 'left' => 'SWIPER_TEXT_POSITION_LEFT', 'center' => 'SWIPER_TEXT_POSITION_CENTER', 'right' => 'SWIPER_TEXT_POSITION_RIGHT', 'bottom' => 'SWIPER_TEXT_POSITION_BOTTOM', 'after' => 'SWIPER_TEXT_POSITION_AFTER', 'random' => 'SWIPER_TEXT_POSITION_RANDOM'); |
50
|
|
|
|
51
|
|
|
return array_merge($config, array( |
52
|
|
|
'layout' => '', |
53
|
|
|
'legend3' => 'SWIPER_SLIDESHOW', |
54
|
|
|
'navigation' => array('lang' => 'SWIPER_NAVIGATION', 'validate' => 'bool', 'type' => 'radio:yes_no', 'default' => 1), |
55
|
|
|
'theme' => array('lang' => 'SWIPER_THEME', 'validate' => 'string', 'type' => 'select', 'options' => $theme_options, 'default' => ''), |
56
|
|
|
'pagination' => array('lang' => 'SWIPER_PAGINATION', 'validate' => 'string', 'type' => 'select', 'options' => $pagination_options, 'default' => 1), |
57
|
|
|
'effect' => array('lang' => 'SWIPER_EFFECT', 'validate' => 'string', 'type' => 'select', 'options' => $effect_options, 'default' => 'slide'), |
58
|
|
|
'parallax' => array('lang' => 'SWIPER_PARALLAX_IMAGE_URL', 'validate' => 'string', 'type' => 'text::255', 'default' => ''), |
59
|
|
|
'direction' => array('lang' => 'SWIPER_DIRECTION', 'validate' => 'string', 'type' => 'select:1:0:direction', 'options' => $direction_options, 'default' => 'horizontal', 'append' => '<div id="direction-vertical" class="error small">' . $this->language->lang('SWIPER_HEIGHT_REQUIRED') . '</div>'), |
60
|
|
|
'height' => array('lang' => 'SWIPER_HEIGHT', 'validate' => 'int:0', 'type' => 'number:0', 'default' => 0, 'append' => 'PIXEL'), |
61
|
|
|
'thumbs' => array('lang' => 'SWIPER_THUMBNAILS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'default' => 0), |
62
|
|
|
'loop' => array('lang' => 'SWIPER_LOOP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'default' => 1), |
63
|
|
|
'autoplay' => array('lang' => 'SWIPER_AUTOPLAY', 'validate' => 'int:0', 'type' => 'number:0', 'default' => 0, 'append' => 'MILLISECONDS'), |
64
|
|
|
'legend4' => 'SWIPER_SLIDES', |
65
|
|
|
'text_position' => array('lang' => 'SWIPER_TEXT_POSITION', 'validate' => 'string', 'type' => 'select', 'options' => $text_pos_options, 'default' => ''), |
66
|
|
|
'slides-per-view' => array('lang' => 'SWIPER_SLIDES_PER_VIEW', 'validate' => 'int:1', 'type' => 'number:1', 'default' => 1), |
67
|
|
|
'slides-per-group' => array('lang' => 'SWIPER_SLIDES_PER_GROUP', 'validate' => 'int:1', 'type' => 'number:1', 'default' => 1), |
68
|
|
|
'space-between' => array('lang' => 'SWIPER_SPACE_BETWEEN_SLIDES', 'validate' => 'int:0', 'type' => 'number:0', 'default' => 10, 'append' => 'PIXEL'), |
69
|
|
|
'set-wrapper-size' => array('lang' => 'SWIPER_EQUAL_HEIGHT_SLIDES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'default' => 1), |
70
|
|
|
'auto-height' => array('lang' => 'SWIPER_AUTO_HEIGHT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'default' => 0), |
71
|
|
|
'centered-slides' => array('lang' => 'SWIPER_CENTERED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'default' => 0), |
72
|
|
|
'free-mode' => array('lang' => 'SWIPER_FREE_MODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'default' => 0), |
73
|
|
|
)); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* {@inheritdoc} |
78
|
|
|
*/ |
79
|
|
|
public function display(array $bdata, $edit_mode = false) |
80
|
|
|
{ |
81
|
|
|
$this->util->add_assets(array( |
82
|
|
|
'js' => array( |
83
|
|
|
'@blitze_content/vendor/swiper/dist/js/swiper.min.js', |
84
|
|
|
'@blitze_content/assets/blocks/swiper.min.js', |
85
|
|
|
), |
86
|
|
|
'css' => array( |
87
|
|
|
'@blitze_content/assets/blocks/swiper.min.css', |
88
|
|
|
) |
89
|
|
|
)); |
90
|
|
|
|
91
|
|
|
$bdata['settings']['layout'] = ''; // key 'layout' is needed by parent |
92
|
|
|
$this->ptemplate->assign_vars(array( |
93
|
|
|
'ID' => $bdata['bid'], |
94
|
|
|
'SETTINGS' => $bdata['settings'], |
95
|
|
|
)); |
96
|
|
|
|
97
|
|
|
return parent::display($bdata, $edit_mode); |
98
|
|
|
} |
99
|
|
|
} |
100
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths