1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,450 +0,0 @@ |
1 |
-<?php |
|
2 |
- |
|
3 |
-/** |
|
4 |
- * Slick slider for Contao |
|
5 |
- * |
|
6 |
- * Copyright (c) 2016 Benjamin Roth |
|
7 |
- * |
|
8 |
- * @license LGPL-3.0+ |
|
9 |
- */ |
|
10 |
- |
|
11 |
- |
|
12 |
-/** |
|
13 |
- * Table tl_content |
|
14 |
- */ |
|
15 |
- |
|
16 |
-/** |
|
17 |
- * Add callback |
|
18 |
- */ |
|
19 |
-$GLOBALS['TL_DCA']['tl_content']['config']['onload_callback'][] = array('tl_content_eSM_slider', 'showJsLibraryHint'); |
|
20 |
-$GLOBALS['TL_DCA']['tl_content']['config']['onsubmit_callback'][] = array('tl_content_eSM_slider', 'insertEndElement'); |
|
21 |
- |
|
22 |
-/** |
|
23 |
- * Add palettes to tl_content |
|
24 |
- */ |
|
25 |
-$GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][] = 'eSM_addImage'; |
|
26 |
-$GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][] = 'eSM_addText'; |
|
27 |
-$GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][] = 'eSM_slider_addImageLink'; |
|
28 |
-$GLOBALS['TL_DCA']['tl_content']['palettes']['swiperSliderStart'] = '{type_legend},type;{swiper_legend},eSM_slider_autoPlaySpeed,eSM_slider_speed,eSM_slider_initialSlide,eSM_slider_preload,eSM_slider_slidesToShow,eSM_slider_slidesToScroll,eSM_slider_infinite,eSM_slider_arrows,eSM_slider_pagination,eSM_slider_stopOnInteraction,eSM_slider_fade,eSM_slider_adaptiveHeight;{breakpoint_legend:hide},eSM_slider_breakpoints;{image_legend},eSM_addImage;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space;{invisible_legend:hide},invisible,start,stop'; |
|
29 |
-$GLOBALS['TL_DCA']['tl_content']['palettes']['swiperSliderStop'] = '{type_legend},type;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests;{invisible_legend:hide},invisible,start,stop'; |
|
30 |
-$GLOBALS['TL_DCA']['tl_content']['palettes']['swiperSliderSlideStart'] = '{type_legend},type;{swiper_legend},eSM_addImage;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space;{invisible_legend:hide},invisible,start,stop'; |
|
31 |
-$GLOBALS['TL_DCA']['tl_content']['palettes']['swiperSliderSlideStop'] = '{type_legend},type;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests;{invisible_legend:hide},invisible,start,stop'; |
|
32 |
-$GLOBALS['TL_DCA']['tl_content']['palettes']['swiperSliderImage'] = '{type_legend},type;{swiper_legend},multiSRC,size,eSM_slider_bgSize,eSM_slider_bgPosition,eSM_slider_minHeight,eSM_slider_bgOpacity,eSM_slider_bgRepeat,eSM_slider_addImageLink,eSM_addText;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space;{invisible_legend:hide},invisible,start,stop'; |
|
33 |
- |
|
34 |
- |
|
35 |
-$GLOBALS['TL_DCA']['tl_content']['subpalettes']['eSM_addImage'] = 'multiSRC,size,eSM_slider_bgSize,eSM_slider_bgPosition,eSM_slider_minHeight,eSM_slider_bgOpacity,eSM_slider_bgRepeat'; |
|
36 |
-$GLOBALS['TL_DCA']['tl_content']['subpalettes']['eSM_addText'] = 'eSM_slider_text,eSM_slider_url'; |
|
37 |
-$GLOBALS['TL_DCA']['tl_content']['subpalettes']['eSM_slider_addImageLink'] = 'imageUrl,fullsize'; |
|
38 |
- |
|
39 |
-/** |
|
40 |
- * Add fields to tl_content |
|
41 |
- */ |
|
42 |
- |
|
43 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_autoPlaySpeed'] = array |
|
44 |
-( |
|
45 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_autoPlaySpeed'], |
|
46 |
- 'exclude' => true, |
|
47 |
- 'inputType' => 'text', |
|
48 |
- 'eval' => array('tl_class'=>'w50','rgxp'=>'digit'), |
|
49 |
- 'sql' => "int(10) unsigned NOT NULL default '0'" |
|
50 |
-); |
|
51 |
- |
|
52 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_speed'] = array |
|
53 |
-( |
|
54 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_speed'], |
|
55 |
- 'exclude' => true, |
|
56 |
- 'inputType' => 'text', |
|
57 |
- 'default' => '500', |
|
58 |
- 'eval' => array('tl_class'=>'w50','rgxp'=>'digit'), |
|
59 |
- 'sql' => "int(10) unsigned NOT NULL default '0'" |
|
60 |
-); |
|
61 |
- |
|
62 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_initialSlide'] = array |
|
63 |
-( |
|
64 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_initialSlide'], |
|
65 |
- 'exclude' => true, |
|
66 |
- 'inputType' => 'text', |
|
67 |
- 'eval' => array('tl_class'=>'w50','rgxp'=>'digit'), |
|
68 |
- 'sql' => "int(10) unsigned NOT NULL default '0'" |
|
69 |
-); |
|
70 |
- |
|
71 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_slidesToShow'] = array |
|
72 |
-( |
|
73 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_slidesToShow'], |
|
74 |
- 'exclude' => true, |
|
75 |
- 'inputType' => 'text', |
|
76 |
- 'eval' => array('rgxp'=>'natural','minval'=>1,'tl_class'=>'w50'), |
|
77 |
- 'sql' => "int(10) unsigned NOT NULL default '1'" |
|
78 |
-); |
|
79 |
- |
|
80 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_slidesToScroll'] = array |
|
81 |
-( |
|
82 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_slidesToScroll'], |
|
83 |
- 'exclude' => true, |
|
84 |
- 'inputType' => 'text', |
|
85 |
- 'eval' => array('rgxp'=>'natural','minval'=>1,'tl_class'=>'w50'), |
|
86 |
- 'sql' => "int(10) unsigned NOT NULL default '1'" |
|
87 |
-); |
|
88 |
- |
|
89 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_infinite'] = array |
|
90 |
-( |
|
91 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_infinite'], |
|
92 |
- 'exclude' => true, |
|
93 |
- 'inputType' => 'checkbox', |
|
94 |
- 'eval' => array('tl_class'=>'w50 m12'), |
|
95 |
- 'sql' => "char(1) NOT NULL default ''" |
|
96 |
-); |
|
97 |
- |
|
98 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_arrows'] = array |
|
99 |
-( |
|
100 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_arrows'], |
|
101 |
- 'inputType' => 'select', |
|
102 |
- 'options' => array |
|
103 |
- ( |
|
104 |
- 'inside', |
|
105 |
- 'outside', |
|
106 |
- ), |
|
107 |
- 'reference' => &$GLOBALS['TL_LANG']['tl_content']['REF']['eSM_slider_arrows'], |
|
108 |
- 'eval' => array('tl_class' => 'w50','includeBlankOption'=>true), |
|
109 |
- 'sql' => "varchar(16) NOT NULL default ''" |
|
110 |
-); |
|
111 |
- |
|
112 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_pagination'] = array |
|
113 |
-( |
|
114 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_pagination'], |
|
115 |
- 'exclude' => true, |
|
116 |
- 'inputType' => 'checkbox', |
|
117 |
- 'eval' => array('tl_class'=>'w50 m12'), |
|
118 |
- 'sql' => "char(1) NOT NULL default ''" |
|
119 |
-); |
|
120 |
- |
|
121 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_stopOnInteraction'] = array |
|
122 |
-( |
|
123 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_stopOnInteraction'], |
|
124 |
- 'exclude' => true, |
|
125 |
- 'inputType' => 'checkbox', |
|
126 |
- 'eval' => array('tl_class'=>'w50 m12'), |
|
127 |
- 'sql' => "char(1) NOT NULL default ''" |
|
128 |
-); |
|
129 |
- |
|
130 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_preload'] = array |
|
131 |
-( |
|
132 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_preload'], |
|
133 |
- 'exclude' => true, |
|
134 |
- 'inputType' => 'checkbox', |
|
135 |
- 'eval' => array('tl_class'=>'w50 m12'), |
|
136 |
- 'sql' => "char(1) NOT NULL default '1'" |
|
137 |
-); |
|
138 |
- |
|
139 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_fade'] = array |
|
140 |
-( |
|
141 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_fade'], |
|
142 |
- 'exclude' => true, |
|
143 |
- 'inputType' => 'checkbox', |
|
144 |
- 'eval' => array('tl_class'=>'w50 m12'), |
|
145 |
- 'sql' => "char(1) NOT NULL default ''" |
|
146 |
-); |
|
147 |
- |
|
148 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_adaptiveHeight'] = array |
|
149 |
-( |
|
150 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_adaptiveHeight'], |
|
151 |
- 'exclude' => true, |
|
152 |
- 'inputType' => 'checkbox', |
|
153 |
- 'eval' => array('tl_class'=>'w50 m12'), |
|
154 |
- 'sql' => "char(1) NOT NULL default ''" |
|
155 |
-); |
|
156 |
- |
|
157 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_breakpoints'] = array |
|
158 |
-( |
|
159 |
- 'exclude' => true, |
|
160 |
- 'inputType' => 'multiColumnWizard', |
|
161 |
- 'eval' => array |
|
162 |
- ( |
|
163 |
- 'columnFields' => array |
|
164 |
- ( |
|
165 |
- 'breakpoint_width' => [ |
|
166 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_breakpoints_width'], |
|
167 |
- 'exclude' => true, |
|
168 |
- 'inputType' => 'text', |
|
169 |
- 'eval' => array('rgxp'=>'natural','minval'=>1,'style' => 'width: 95%;'), |
|
170 |
- ], |
|
171 |
- 'breakpoint_slidesToShow' => [ |
|
172 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_slidesToShow'], |
|
173 |
- 'exclude' => true, |
|
174 |
- 'inputType' => 'text', |
|
175 |
- 'eval' => array('rgxp'=>'natural','minval'=>1,'style' => 'width: 95%;'), |
|
176 |
- ], |
|
177 |
- 'breakpoint_slidesToScroll' => [ |
|
178 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_slidesToScroll'], |
|
179 |
- 'exclude' => true, |
|
180 |
- 'inputType' => 'text', |
|
181 |
- 'eval' => array('rgxp'=>'natural','minval'=>1,'style' => 'width: 95%;'), |
|
182 |
- ], |
|
183 |
- ), |
|
184 |
- ), |
|
185 |
- 'sql' => 'blob NULL', |
|
186 |
-); |
|
187 |
- |
|
188 |
- |
|
189 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_text'] = array |
|
190 |
-( |
|
191 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_text'], |
|
192 |
- 'exclude' => true, |
|
193 |
- 'inputType' => 'textarea', |
|
194 |
- 'eval' => array('rows'=>2,'style'=>'height: 2em;', 'maxlength'=>64), |
|
195 |
- 'sql' => "varchar(64) NOT NULL default ''" |
|
196 |
-); |
|
197 |
- |
|
198 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_url'] = array |
|
199 |
-( |
|
200 |
- 'label' => &$GLOBALS['TL_LANG']['MSC']['url'], |
|
201 |
- 'exclude' => true, |
|
202 |
- 'inputType' => 'text', |
|
203 |
- 'eval' => array('rgxp'=>'url', 'decodeEntities'=>true, 'maxlength'=>255, 'fieldType'=>'radio', 'filesOnly'=>true, 'tl_class'=>'w50 wizard'), |
|
204 |
- 'wizard' => array |
|
205 |
- ( |
|
206 |
- array('tl_content', 'pagePicker') |
|
207 |
- ), |
|
208 |
- 'sql' => "varchar(255) NOT NULL default ''" |
|
209 |
-); |
|
210 |
- |
|
211 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_addImage'] = array |
|
212 |
-( |
|
213 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['addImage'], |
|
214 |
- 'exclude' => true, |
|
215 |
- 'inputType' => 'checkbox', |
|
216 |
- 'eval' => array('submitOnChange'=>true), |
|
217 |
- 'sql' => "char(1) NOT NULL default ''" |
|
218 |
-); |
|
219 |
- |
|
220 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_addText'] = array |
|
221 |
-( |
|
222 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_addText'], |
|
223 |
- 'exclude' => true, |
|
224 |
- 'inputType' => 'checkbox', |
|
225 |
- 'eval' => array('tl_class'=>'clr', 'submitOnChange'=>true), |
|
226 |
- 'sql' => "char(1) NOT NULL default ''" |
|
227 |
-); |
|
228 |
- |
|
229 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_minHeight'] = array |
|
230 |
-( |
|
231 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_minHeight'], |
|
232 |
- 'exclude' => true, |
|
233 |
- 'inputType' => 'checkbox', |
|
234 |
- 'eval' => array('tl_class'=>'w50 m12'), |
|
235 |
- 'sql' => "char(1) NOT NULL default ''" |
|
236 |
-); |
|
237 |
- |
|
238 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_addImageLink'] = array |
|
239 |
-( |
|
240 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_addImageLink'], |
|
241 |
- 'exclude' => true, |
|
242 |
- 'inputType' => 'checkbox', |
|
243 |
- 'eval' => array('tl_class'=>'clr w50','submitOnChange'=>true), |
|
244 |
- 'sql' => "char(1) NOT NULL default ''" |
|
245 |
-); |
|
246 |
- |
|
247 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_bgPosition'] = array |
|
248 |
-( |
|
249 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_bgPosition'], |
|
250 |
- 'exclude' => true, |
|
251 |
- 'inputType' => 'select', |
|
252 |
- 'options' => array |
|
253 |
- ( |
|
254 |
- '0 0' => 'Links | Oben', |
|
255 |
- '50% 0' => 'Mitte | Oben', |
|
256 |
- '100% 0' => 'Rechts | Oben', |
|
257 |
- '0 50%' => 'Links | Mitte', |
|
258 |
- '50% 50%' => 'Mitte | Mitte', |
|
259 |
- '100% 50%' => 'Rechts | Mitte', |
|
260 |
- '0 100%' => 'Links | Unten', |
|
261 |
- '50% 100%' => 'Mitte | Unten', |
|
262 |
- '100% 100%' => 'Rechts | Unten', |
|
263 |
- ), |
|
264 |
- 'eval' => array('tl_class' => 'w50','includeBlankOption'=>true), |
|
265 |
- 'sql' => "varchar(16) NOT NULL default ''" |
|
266 |
-); |
|
267 |
- |
|
268 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_bgSize'] = array |
|
269 |
-( |
|
270 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_bgSize'], |
|
271 |
- 'exclude' => true, |
|
272 |
- 'inputType' => 'select', |
|
273 |
- 'options' => array |
|
274 |
- ( |
|
275 |
- 'contain' => 'Proportional', |
|
276 |
- '100% 100%' => 'Verzerrt', |
|
277 |
- 'auto auto' => 'Originalgröße', |
|
278 |
- ), |
|
279 |
- 'eval' => array('tl_class' => 'w50','includeBlankOption'=>true,'blankOptionLabel'=>'Beschnitten'), |
|
280 |
- 'sql' => "varchar(16) NOT NULL default ''" |
|
281 |
-); |
|
282 |
- |
|
283 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_bgRepeat'] = array |
|
284 |
-( |
|
285 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_bgRepeat'], |
|
286 |
- 'exclude' => true, |
|
287 |
- 'inputType' => 'select', |
|
288 |
- 'options' => array |
|
289 |
- ( |
|
290 |
- 'repeat-x' => 'Horizontal wiederholen', |
|
291 |
- 'repeat-y' => 'Vertikal wiedeholen', |
|
292 |
- 'no-repeat' => 'Nicht wiederholen', |
|
293 |
- ), |
|
294 |
- 'eval' => array('tl_class' => 'w50','includeBlankOption'=>true,'blankOptionLabel'=>'Wiederholen'), |
|
295 |
- 'sql' => "varchar(16) NOT NULL default ''" |
|
296 |
-); |
|
297 |
- |
|
298 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_bgOpacity'] = array |
|
299 |
-( |
|
300 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_bgOpacity'], |
|
301 |
- 'exclude' => true, |
|
302 |
- 'inputType' => 'select', |
|
303 |
- 'options' => array |
|
304 |
- ( |
|
305 |
- '10' => '10%', |
|
306 |
- '20' => '20%', |
|
307 |
- '30' => '30%', |
|
308 |
- '40' => '40%', |
|
309 |
- '50' => '50%', |
|
310 |
- '60' => '60%', |
|
311 |
- '70' => '70%', |
|
312 |
- '80' => '80%', |
|
313 |
- '90' => '90%', |
|
314 |
- '100' => '100%', |
|
315 |
- ), |
|
316 |
- 'eval' => array('tl_class' => 'w50','includeBlankOption'=>true), |
|
317 |
- 'sql' => "varchar(16) NOT NULL default ''" |
|
318 |
-); |
|
319 |
- |
|
320 |
-$GLOBALS['TL_DCA']['tl_content']['fields']['multiSRC']['load_callback'][] = array('tl_content_eSM_slider', 'setMultiSrcFlags'); |
|
321 |
- |
|
322 |
- |
|
323 |
-class tl_content_eSM_slider extends Backend |
|
324 |
-{ |
|
325 |
- |
|
326 |
- /** |
|
327 |
- * Import the back end user object |
|
328 |
- */ |
|
329 |
- public function __construct() |
|
330 |
- { |
|
331 |
- parent::__construct(); |
|
332 |
- $this->import('BackendUser', 'User'); |
|
333 |
- } |
|
334 |
- |
|
335 |
- /** |
|
336 |
- * Show a hint if a JavaScript library needs to be included in the page layout |
|
337 |
- * |
|
338 |
- * @param object |
|
339 |
- */ |
|
340 |
- public function showJsLibraryHint($dc) |
|
341 |
- { |
|
342 |
- if ($_POST || Input::get('act') != 'edit') |
|
343 |
- { |
|
344 |
- return; |
|
345 |
- } |
|
346 |
- |
|
347 |
- // Return if the user cannot access the layout module (see #6190) |
|
348 |
- if (!$this->User->hasAccess('themes', 'modules') || !$this->User->hasAccess('layout', 'themes')) |
|
349 |
- { |
|
350 |
- return; |
|
351 |
- } |
|
352 |
- |
|
353 |
- $objCte = ContentModel::findByPk($dc->id); |
|
354 |
- |
|
355 |
- if ($objCte === null) |
|
356 |
- { |
|
357 |
- return; |
|
358 |
- } |
|
359 |
- |
|
360 |
- switch ($objCte->type) |
|
361 |
- { |
|
362 |
- case 'swiperSliderStart': |
|
363 |
- case 'swiperSliderStop': |
|
364 |
- case 'swiperSliderSlideStart': |
|
365 |
- case 'swiperSliderSlideStop': |
|
366 |
- case 'swiperSliderImage': |
|
367 |
- Message::addInfo(sprintf($GLOBALS['TL_LANG']['tl_content']['includeTemplatesJQuery'], 'js_swiper')); |
|
368 |
- break; |
|
369 |
- } |
|
370 |
- } |
|
371 |
- |
|
372 |
- /** |
|
373 |
- * Automatically insert end element if start element ist about to be added |
|
374 |
- * |
|
375 |
- * @param DataContainer $dc |
|
376 |
- */ |
|
377 |
- public function insertEndElement(\DataContainer $dc) |
|
378 |
- { |
|
379 |
- $activeRecord = $dc->activeRecord; |
|
380 |
- if (!$activeRecord) { |
|
381 |
- return; |
|
382 |
- } |
|
383 |
- |
|
384 |
- if ($activeRecord->type === 'swiperSliderStart' || $activeRecord->type === 'swiperSliderSlideStart') { |
|
385 |
- |
|
386 |
- // Find the next wrapper element |
|
387 |
- $nextElement = \Database::getInstance() |
|
388 |
- ->prepare(" |
|
389 |
- SELECT type |
|
390 |
- FROM tl_content |
|
391 |
- WHERE pid = ? |
|
392 |
- AND (ptable = ? OR ptable = ?) |
|
393 |
- AND type IN ('swiperSliderSlideStart', 'swiperSliderSlideStop','swiperSliderStart', 'swiperSliderStop') |
|
394 |
- AND sorting > ? |
|
395 |
- ORDER BY sorting ASC |
|
396 |
- LIMIT 1 |
|
397 |
- ") |
|
398 |
- ->execute( |
|
399 |
- $activeRecord->pid, |
|
400 |
- $activeRecord->ptable ?: 'tl_article', |
|
401 |
- $activeRecord->ptable === 'tl_article' ? '' : $activeRecord->ptable, |
|
402 |
- $activeRecord->sorting |
|
403 |
- ); |
|
404 |
- |
|
405 |
- // Check if a stop element should be created |
|
406 |
- if ( |
|
407 |
- !$nextElement->type |
|
408 |
- || ($activeRecord->type === 'swiperSliderStart' && ($nextElement->type === 'swiperSliderStart')) |
|
409 |
- || ($activeRecord->type === 'swiperSliderSlideStart' && ($nextElement->type === 'swiperSliderSlideStart' || $nextElement->type === 'swiperSliderStart' || $nextElement->type === 'swiperSliderStop')) |
|
410 |
- ) { |
|
411 |
- \Database::getInstance() |
|
412 |
- ->prepare('INSERT INTO tl_content %s') |
|
413 |
- ->set(array( |
|
414 |
- 'pid' => $activeRecord->pid, |
|
415 |
- 'ptable' => $activeRecord->ptable ?: 'tl_article', |
|
416 |
- 'type' => substr($activeRecord->type, 0, -5) . 'Stop', |
|
417 |
- 'sorting' => $activeRecord->sorting + 1, |
|
418 |
- 'tstamp' => time(), |
|
419 |
- )) |
|
420 |
- ->execute(); |
|
421 |
- } |
|
422 |
- |
|
423 |
- } |
|
424 |
- } |
|
425 |
- |
|
426 |
- /** |
|
427 |
- * Dynamically add flags to the "multiSRC" field |
|
428 |
- * |
|
429 |
- * @param mixed $varValue |
|
430 |
- * @param Contao\DataContainer $dc |
|
431 |
- * |
|
432 |
- * @return mixed |
|
433 |
- */ |
|
434 |
- public function setMultiSrcFlags($varValue, Contao\DataContainer $dc) |
|
435 |
- { |
|
436 |
- if ($dc->activeRecord) |
|
437 |
- { |
|
438 |
- switch ($dc->activeRecord->type) |
|
439 |
- { |
|
440 |
- case 'swiperSliderStart': |
|
441 |
- case 'swiperSliderSlideStart': |
|
442 |
- case 'swiperSliderImage': |
|
443 |
- $GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['eval']['isGallery'] = true; |
|
444 |
- $GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['eval']['extensions'] = Contao\Config::get('validImageTypes').'mp4,ogv,webm,mov'; |
|
445 |
- break; |
|
446 |
- } |
|
447 |
- } |
|
448 |
- return $varValue; |
|
449 |
- } |
|
450 |
-} |
|
451 | 0 |
\ No newline at end of file |
... | ... |
@@ -98,10 +98,15 @@ $GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_infinite'] = array |
98 | 98 |
$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_arrows'] = array |
99 | 99 |
( |
100 | 100 |
'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_arrows'], |
101 |
- 'exclude' => true, |
|
102 |
- 'inputType' => 'checkbox', |
|
103 |
- 'eval' => array('tl_class'=>'w50 m12'), |
|
104 |
- 'sql' => "char(1) NOT NULL default ''" |
|
101 |
+ 'inputType' => 'select', |
|
102 |
+ 'options' => array |
|
103 |
+ ( |
|
104 |
+ 'inside', |
|
105 |
+ 'outside', |
|
106 |
+ ), |
|
107 |
+ 'reference' => &$GLOBALS['TL_LANG']['tl_content']['REF']['eSM_slider_arrows'], |
|
108 |
+ 'eval' => array('tl_class' => 'w50','includeBlankOption'=>true), |
|
109 |
+ 'sql' => "varchar(16) NOT NULL default ''" |
|
105 | 110 |
); |
106 | 111 |
|
107 | 112 |
$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_pagination'] = array |
... | ... |
@@ -164,13 +164,13 @@ $GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_breakpoints'] = array |
164 | 164 |
'eval' => array('rgxp'=>'natural','minval'=>1,'style' => 'width: 95%;'), |
165 | 165 |
], |
166 | 166 |
'breakpoint_slidesToShow' => [ |
167 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_breakpoints_slidesToShow'], |
|
167 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_slidesToShow'], |
|
168 | 168 |
'exclude' => true, |
169 | 169 |
'inputType' => 'text', |
170 | 170 |
'eval' => array('rgxp'=>'natural','minval'=>1,'style' => 'width: 95%;'), |
171 | 171 |
], |
172 | 172 |
'breakpoint_slidesToScroll' => [ |
173 |
- 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_breakpoints_slidesToScroll'], |
|
173 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_slidesToScroll'], |
|
174 | 174 |
'exclude' => true, |
175 | 175 |
'inputType' => 'text', |
176 | 176 |
'eval' => array('rgxp'=>'natural','minval'=>1,'style' => 'width: 95%;'), |
... | ... |
@@ -25,7 +25,7 @@ $GLOBALS['TL_DCA']['tl_content']['config']['onsubmit_callback'][] = array('tl_co |
25 | 25 |
$GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][] = 'eSM_addImage'; |
26 | 26 |
$GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][] = 'eSM_addText'; |
27 | 27 |
$GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][] = 'eSM_slider_addImageLink'; |
28 |
-$GLOBALS['TL_DCA']['tl_content']['palettes']['swiperSliderStart'] = '{type_legend},type;{swiper_legend},eSM_slider_autoPlaySpeed,eSM_slider_speed,eSM_slider_initialSlide,eSM_slider_preload,eSM_slider_slidesToShow,eSM_slider_slidesToScroll,eSM_slider_infinite,eSM_slider_arrows,eSM_slider_pagination,eSM_slider_stopOnInteraction,eSM_slider_fade,eSM_slider_adaptiveHeight;{image_legend},eSM_addImage;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space;{invisible_legend:hide},invisible,start,stop'; |
|
28 |
+$GLOBALS['TL_DCA']['tl_content']['palettes']['swiperSliderStart'] = '{type_legend},type;{swiper_legend},eSM_slider_autoPlaySpeed,eSM_slider_speed,eSM_slider_initialSlide,eSM_slider_preload,eSM_slider_slidesToShow,eSM_slider_slidesToScroll,eSM_slider_infinite,eSM_slider_arrows,eSM_slider_pagination,eSM_slider_stopOnInteraction,eSM_slider_fade,eSM_slider_adaptiveHeight;{breakpoint_legend:hide},eSM_slider_breakpoints;{image_legend},eSM_addImage;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space;{invisible_legend:hide},invisible,start,stop'; |
|
29 | 29 |
$GLOBALS['TL_DCA']['tl_content']['palettes']['swiperSliderStop'] = '{type_legend},type;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests;{invisible_legend:hide},invisible,start,stop'; |
30 | 30 |
$GLOBALS['TL_DCA']['tl_content']['palettes']['swiperSliderSlideStart'] = '{type_legend},type;{swiper_legend},eSM_addImage;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space;{invisible_legend:hide},invisible,start,stop'; |
31 | 31 |
$GLOBALS['TL_DCA']['tl_content']['palettes']['swiperSliderSlideStop'] = '{type_legend},type;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests;{invisible_legend:hide},invisible,start,stop'; |
... | ... |
@@ -149,6 +149,38 @@ $GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_adaptiveHeight'] = array |
149 | 149 |
'sql' => "char(1) NOT NULL default ''" |
150 | 150 |
); |
151 | 151 |
|
152 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_breakpoints'] = array |
|
153 |
+( |
|
154 |
+ 'exclude' => true, |
|
155 |
+ 'inputType' => 'multiColumnWizard', |
|
156 |
+ 'eval' => array |
|
157 |
+ ( |
|
158 |
+ 'columnFields' => array |
|
159 |
+ ( |
|
160 |
+ 'breakpoint_width' => [ |
|
161 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_breakpoints_width'], |
|
162 |
+ 'exclude' => true, |
|
163 |
+ 'inputType' => 'text', |
|
164 |
+ 'eval' => array('rgxp'=>'natural','minval'=>1,'style' => 'width: 95%;'), |
|
165 |
+ ], |
|
166 |
+ 'breakpoint_slidesToShow' => [ |
|
167 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_breakpoints_slidesToShow'], |
|
168 |
+ 'exclude' => true, |
|
169 |
+ 'inputType' => 'text', |
|
170 |
+ 'eval' => array('rgxp'=>'natural','minval'=>1,'style' => 'width: 95%;'), |
|
171 |
+ ], |
|
172 |
+ 'breakpoint_slidesToScroll' => [ |
|
173 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_breakpoints_slidesToScroll'], |
|
174 |
+ 'exclude' => true, |
|
175 |
+ 'inputType' => 'text', |
|
176 |
+ 'eval' => array('rgxp'=>'natural','minval'=>1,'style' => 'width: 95%;'), |
|
177 |
+ ], |
|
178 |
+ ), |
|
179 |
+ ), |
|
180 |
+ 'sql' => 'blob NULL', |
|
181 |
+); |
|
182 |
+ |
|
183 |
+ |
|
152 | 184 |
$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_text'] = array |
153 | 185 |
( |
154 | 186 |
'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_text'], |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,413 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Slick slider for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2016 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license LGPL-3.0+ |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+ |
|
12 |
+/** |
|
13 |
+ * Table tl_content |
|
14 |
+ */ |
|
15 |
+ |
|
16 |
+/** |
|
17 |
+ * Add callback |
|
18 |
+ */ |
|
19 |
+$GLOBALS['TL_DCA']['tl_content']['config']['onload_callback'][] = array('tl_content_eSM_slider', 'showJsLibraryHint'); |
|
20 |
+$GLOBALS['TL_DCA']['tl_content']['config']['onsubmit_callback'][] = array('tl_content_eSM_slider', 'insertEndElement'); |
|
21 |
+ |
|
22 |
+/** |
|
23 |
+ * Add palettes to tl_content |
|
24 |
+ */ |
|
25 |
+$GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][] = 'eSM_addImage'; |
|
26 |
+$GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][] = 'eSM_addText'; |
|
27 |
+$GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][] = 'eSM_slider_addImageLink'; |
|
28 |
+$GLOBALS['TL_DCA']['tl_content']['palettes']['swiperSliderStart'] = '{type_legend},type;{swiper_legend},eSM_slider_autoPlaySpeed,eSM_slider_speed,eSM_slider_initialSlide,eSM_slider_preload,eSM_slider_slidesToShow,eSM_slider_slidesToScroll,eSM_slider_infinite,eSM_slider_arrows,eSM_slider_pagination,eSM_slider_stopOnInteraction,eSM_slider_fade,eSM_slider_adaptiveHeight;{image_legend},eSM_addImage;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space;{invisible_legend:hide},invisible,start,stop'; |
|
29 |
+$GLOBALS['TL_DCA']['tl_content']['palettes']['swiperSliderStop'] = '{type_legend},type;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests;{invisible_legend:hide},invisible,start,stop'; |
|
30 |
+$GLOBALS['TL_DCA']['tl_content']['palettes']['swiperSliderSlideStart'] = '{type_legend},type;{swiper_legend},eSM_addImage;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space;{invisible_legend:hide},invisible,start,stop'; |
|
31 |
+$GLOBALS['TL_DCA']['tl_content']['palettes']['swiperSliderSlideStop'] = '{type_legend},type;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests;{invisible_legend:hide},invisible,start,stop'; |
|
32 |
+$GLOBALS['TL_DCA']['tl_content']['palettes']['swiperSliderImage'] = '{type_legend},type;{swiper_legend},multiSRC,size,eSM_slider_bgSize,eSM_slider_bgPosition,eSM_slider_minHeight,eSM_slider_bgOpacity,eSM_slider_bgRepeat,eSM_slider_addImageLink,eSM_addText;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space;{invisible_legend:hide},invisible,start,stop'; |
|
33 |
+ |
|
34 |
+ |
|
35 |
+$GLOBALS['TL_DCA']['tl_content']['subpalettes']['eSM_addImage'] = 'multiSRC,size,eSM_slider_bgSize,eSM_slider_bgPosition,eSM_slider_minHeight,eSM_slider_bgOpacity,eSM_slider_bgRepeat'; |
|
36 |
+$GLOBALS['TL_DCA']['tl_content']['subpalettes']['eSM_addText'] = 'eSM_slider_text,eSM_slider_url'; |
|
37 |
+$GLOBALS['TL_DCA']['tl_content']['subpalettes']['eSM_slider_addImageLink'] = 'imageUrl,fullsize'; |
|
38 |
+ |
|
39 |
+/** |
|
40 |
+ * Add fields to tl_content |
|
41 |
+ */ |
|
42 |
+ |
|
43 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_autoPlaySpeed'] = array |
|
44 |
+( |
|
45 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_autoPlaySpeed'], |
|
46 |
+ 'exclude' => true, |
|
47 |
+ 'inputType' => 'text', |
|
48 |
+ 'eval' => array('tl_class'=>'w50','rgxp'=>'digit'), |
|
49 |
+ 'sql' => "int(10) unsigned NOT NULL default '0'" |
|
50 |
+); |
|
51 |
+ |
|
52 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_speed'] = array |
|
53 |
+( |
|
54 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_speed'], |
|
55 |
+ 'exclude' => true, |
|
56 |
+ 'inputType' => 'text', |
|
57 |
+ 'default' => '500', |
|
58 |
+ 'eval' => array('tl_class'=>'w50','rgxp'=>'digit'), |
|
59 |
+ 'sql' => "int(10) unsigned NOT NULL default '0'" |
|
60 |
+); |
|
61 |
+ |
|
62 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_initialSlide'] = array |
|
63 |
+( |
|
64 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_initialSlide'], |
|
65 |
+ 'exclude' => true, |
|
66 |
+ 'inputType' => 'text', |
|
67 |
+ 'eval' => array('tl_class'=>'w50','rgxp'=>'digit'), |
|
68 |
+ 'sql' => "int(10) unsigned NOT NULL default '0'" |
|
69 |
+); |
|
70 |
+ |
|
71 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_slidesToShow'] = array |
|
72 |
+( |
|
73 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_slidesToShow'], |
|
74 |
+ 'exclude' => true, |
|
75 |
+ 'inputType' => 'text', |
|
76 |
+ 'eval' => array('rgxp'=>'natural','minval'=>1,'tl_class'=>'w50'), |
|
77 |
+ 'sql' => "int(10) unsigned NOT NULL default '1'" |
|
78 |
+); |
|
79 |
+ |
|
80 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_slidesToScroll'] = array |
|
81 |
+( |
|
82 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_slidesToScroll'], |
|
83 |
+ 'exclude' => true, |
|
84 |
+ 'inputType' => 'text', |
|
85 |
+ 'eval' => array('rgxp'=>'natural','minval'=>1,'tl_class'=>'w50'), |
|
86 |
+ 'sql' => "int(10) unsigned NOT NULL default '1'" |
|
87 |
+); |
|
88 |
+ |
|
89 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_infinite'] = array |
|
90 |
+( |
|
91 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_infinite'], |
|
92 |
+ 'exclude' => true, |
|
93 |
+ 'inputType' => 'checkbox', |
|
94 |
+ 'eval' => array('tl_class'=>'w50 m12'), |
|
95 |
+ 'sql' => "char(1) NOT NULL default ''" |
|
96 |
+); |
|
97 |
+ |
|
98 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_arrows'] = array |
|
99 |
+( |
|
100 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_arrows'], |
|
101 |
+ 'exclude' => true, |
|
102 |
+ 'inputType' => 'checkbox', |
|
103 |
+ 'eval' => array('tl_class'=>'w50 m12'), |
|
104 |
+ 'sql' => "char(1) NOT NULL default ''" |
|
105 |
+); |
|
106 |
+ |
|
107 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_pagination'] = array |
|
108 |
+( |
|
109 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_pagination'], |
|
110 |
+ 'exclude' => true, |
|
111 |
+ 'inputType' => 'checkbox', |
|
112 |
+ 'eval' => array('tl_class'=>'w50 m12'), |
|
113 |
+ 'sql' => "char(1) NOT NULL default ''" |
|
114 |
+); |
|
115 |
+ |
|
116 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_stopOnInteraction'] = array |
|
117 |
+( |
|
118 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_stopOnInteraction'], |
|
119 |
+ 'exclude' => true, |
|
120 |
+ 'inputType' => 'checkbox', |
|
121 |
+ 'eval' => array('tl_class'=>'w50 m12'), |
|
122 |
+ 'sql' => "char(1) NOT NULL default ''" |
|
123 |
+); |
|
124 |
+ |
|
125 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_preload'] = array |
|
126 |
+( |
|
127 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_preload'], |
|
128 |
+ 'exclude' => true, |
|
129 |
+ 'inputType' => 'checkbox', |
|
130 |
+ 'eval' => array('tl_class'=>'w50 m12'), |
|
131 |
+ 'sql' => "char(1) NOT NULL default '1'" |
|
132 |
+); |
|
133 |
+ |
|
134 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_fade'] = array |
|
135 |
+( |
|
136 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_fade'], |
|
137 |
+ 'exclude' => true, |
|
138 |
+ 'inputType' => 'checkbox', |
|
139 |
+ 'eval' => array('tl_class'=>'w50 m12'), |
|
140 |
+ 'sql' => "char(1) NOT NULL default ''" |
|
141 |
+); |
|
142 |
+ |
|
143 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_adaptiveHeight'] = array |
|
144 |
+( |
|
145 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_adaptiveHeight'], |
|
146 |
+ 'exclude' => true, |
|
147 |
+ 'inputType' => 'checkbox', |
|
148 |
+ 'eval' => array('tl_class'=>'w50 m12'), |
|
149 |
+ 'sql' => "char(1) NOT NULL default ''" |
|
150 |
+); |
|
151 |
+ |
|
152 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_text'] = array |
|
153 |
+( |
|
154 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_text'], |
|
155 |
+ 'exclude' => true, |
|
156 |
+ 'inputType' => 'textarea', |
|
157 |
+ 'eval' => array('rows'=>2,'style'=>'height: 2em;', 'maxlength'=>64), |
|
158 |
+ 'sql' => "varchar(64) NOT NULL default ''" |
|
159 |
+); |
|
160 |
+ |
|
161 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_url'] = array |
|
162 |
+( |
|
163 |
+ 'label' => &$GLOBALS['TL_LANG']['MSC']['url'], |
|
164 |
+ 'exclude' => true, |
|
165 |
+ 'inputType' => 'text', |
|
166 |
+ 'eval' => array('rgxp'=>'url', 'decodeEntities'=>true, 'maxlength'=>255, 'fieldType'=>'radio', 'filesOnly'=>true, 'tl_class'=>'w50 wizard'), |
|
167 |
+ 'wizard' => array |
|
168 |
+ ( |
|
169 |
+ array('tl_content', 'pagePicker') |
|
170 |
+ ), |
|
171 |
+ 'sql' => "varchar(255) NOT NULL default ''" |
|
172 |
+); |
|
173 |
+ |
|
174 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_addImage'] = array |
|
175 |
+( |
|
176 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['addImage'], |
|
177 |
+ 'exclude' => true, |
|
178 |
+ 'inputType' => 'checkbox', |
|
179 |
+ 'eval' => array('submitOnChange'=>true), |
|
180 |
+ 'sql' => "char(1) NOT NULL default ''" |
|
181 |
+); |
|
182 |
+ |
|
183 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_addText'] = array |
|
184 |
+( |
|
185 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_addText'], |
|
186 |
+ 'exclude' => true, |
|
187 |
+ 'inputType' => 'checkbox', |
|
188 |
+ 'eval' => array('tl_class'=>'clr', 'submitOnChange'=>true), |
|
189 |
+ 'sql' => "char(1) NOT NULL default ''" |
|
190 |
+); |
|
191 |
+ |
|
192 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_minHeight'] = array |
|
193 |
+( |
|
194 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_minHeight'], |
|
195 |
+ 'exclude' => true, |
|
196 |
+ 'inputType' => 'checkbox', |
|
197 |
+ 'eval' => array('tl_class'=>'w50 m12'), |
|
198 |
+ 'sql' => "char(1) NOT NULL default ''" |
|
199 |
+); |
|
200 |
+ |
|
201 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_addImageLink'] = array |
|
202 |
+( |
|
203 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_addImageLink'], |
|
204 |
+ 'exclude' => true, |
|
205 |
+ 'inputType' => 'checkbox', |
|
206 |
+ 'eval' => array('tl_class'=>'clr w50','submitOnChange'=>true), |
|
207 |
+ 'sql' => "char(1) NOT NULL default ''" |
|
208 |
+); |
|
209 |
+ |
|
210 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_bgPosition'] = array |
|
211 |
+( |
|
212 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_bgPosition'], |
|
213 |
+ 'exclude' => true, |
|
214 |
+ 'inputType' => 'select', |
|
215 |
+ 'options' => array |
|
216 |
+ ( |
|
217 |
+ '0 0' => 'Links | Oben', |
|
218 |
+ '50% 0' => 'Mitte | Oben', |
|
219 |
+ '100% 0' => 'Rechts | Oben', |
|
220 |
+ '0 50%' => 'Links | Mitte', |
|
221 |
+ '50% 50%' => 'Mitte | Mitte', |
|
222 |
+ '100% 50%' => 'Rechts | Mitte', |
|
223 |
+ '0 100%' => 'Links | Unten', |
|
224 |
+ '50% 100%' => 'Mitte | Unten', |
|
225 |
+ '100% 100%' => 'Rechts | Unten', |
|
226 |
+ ), |
|
227 |
+ 'eval' => array('tl_class' => 'w50','includeBlankOption'=>true), |
|
228 |
+ 'sql' => "varchar(16) NOT NULL default ''" |
|
229 |
+); |
|
230 |
+ |
|
231 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_bgSize'] = array |
|
232 |
+( |
|
233 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_bgSize'], |
|
234 |
+ 'exclude' => true, |
|
235 |
+ 'inputType' => 'select', |
|
236 |
+ 'options' => array |
|
237 |
+ ( |
|
238 |
+ 'contain' => 'Proportional', |
|
239 |
+ '100% 100%' => 'Verzerrt', |
|
240 |
+ 'auto auto' => 'Originalgröße', |
|
241 |
+ ), |
|
242 |
+ 'eval' => array('tl_class' => 'w50','includeBlankOption'=>true,'blankOptionLabel'=>'Beschnitten'), |
|
243 |
+ 'sql' => "varchar(16) NOT NULL default ''" |
|
244 |
+); |
|
245 |
+ |
|
246 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_bgRepeat'] = array |
|
247 |
+( |
|
248 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_bgRepeat'], |
|
249 |
+ 'exclude' => true, |
|
250 |
+ 'inputType' => 'select', |
|
251 |
+ 'options' => array |
|
252 |
+ ( |
|
253 |
+ 'repeat-x' => 'Horizontal wiederholen', |
|
254 |
+ 'repeat-y' => 'Vertikal wiedeholen', |
|
255 |
+ 'no-repeat' => 'Nicht wiederholen', |
|
256 |
+ ), |
|
257 |
+ 'eval' => array('tl_class' => 'w50','includeBlankOption'=>true,'blankOptionLabel'=>'Wiederholen'), |
|
258 |
+ 'sql' => "varchar(16) NOT NULL default ''" |
|
259 |
+); |
|
260 |
+ |
|
261 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slider_bgOpacity'] = array |
|
262 |
+( |
|
263 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slider_bgOpacity'], |
|
264 |
+ 'exclude' => true, |
|
265 |
+ 'inputType' => 'select', |
|
266 |
+ 'options' => array |
|
267 |
+ ( |
|
268 |
+ '10' => '10%', |
|
269 |
+ '20' => '20%', |
|
270 |
+ '30' => '30%', |
|
271 |
+ '40' => '40%', |
|
272 |
+ '50' => '50%', |
|
273 |
+ '60' => '60%', |
|
274 |
+ '70' => '70%', |
|
275 |
+ '80' => '80%', |
|
276 |
+ '90' => '90%', |
|
277 |
+ '100' => '100%', |
|
278 |
+ ), |
|
279 |
+ 'eval' => array('tl_class' => 'w50','includeBlankOption'=>true), |
|
280 |
+ 'sql' => "varchar(16) NOT NULL default ''" |
|
281 |
+); |
|
282 |
+ |
|
283 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['multiSRC']['load_callback'][] = array('tl_content_eSM_slider', 'setMultiSrcFlags'); |
|
284 |
+ |
|
285 |
+ |
|
286 |
+class tl_content_eSM_slider extends Backend |
|
287 |
+{ |
|
288 |
+ |
|
289 |
+ /** |
|
290 |
+ * Import the back end user object |
|
291 |
+ */ |
|
292 |
+ public function __construct() |
|
293 |
+ { |
|
294 |
+ parent::__construct(); |
|
295 |
+ $this->import('BackendUser', 'User'); |
|
296 |
+ } |
|
297 |
+ |
|
298 |
+ /** |
|
299 |
+ * Show a hint if a JavaScript library needs to be included in the page layout |
|
300 |
+ * |
|
301 |
+ * @param object |
|
302 |
+ */ |
|
303 |
+ public function showJsLibraryHint($dc) |
|
304 |
+ { |
|
305 |
+ if ($_POST || Input::get('act') != 'edit') |
|
306 |
+ { |
|
307 |
+ return; |
|
308 |
+ } |
|
309 |
+ |
|
310 |
+ // Return if the user cannot access the layout module (see #6190) |
|
311 |
+ if (!$this->User->hasAccess('themes', 'modules') || !$this->User->hasAccess('layout', 'themes')) |
|
312 |
+ { |
|
313 |
+ return; |
|
314 |
+ } |
|
315 |
+ |
|
316 |
+ $objCte = ContentModel::findByPk($dc->id); |
|
317 |
+ |
|
318 |
+ if ($objCte === null) |
|
319 |
+ { |
|
320 |
+ return; |
|
321 |
+ } |
|
322 |
+ |
|
323 |
+ switch ($objCte->type) |
|
324 |
+ { |
|
325 |
+ case 'swiperSliderStart': |
|
326 |
+ case 'swiperSliderStop': |
|
327 |
+ case 'swiperSliderSlideStart': |
|
328 |
+ case 'swiperSliderSlideStop': |
|
329 |
+ case 'swiperSliderImage': |
|
330 |
+ Message::addInfo(sprintf($GLOBALS['TL_LANG']['tl_content']['includeTemplatesJQuery'], 'js_swiper')); |
|
331 |
+ break; |
|
332 |
+ } |
|
333 |
+ } |
|
334 |
+ |
|
335 |
+ /** |
|
336 |
+ * Automatically insert end element if start element ist about to be added |
|
337 |
+ * |
|
338 |
+ * @param DataContainer $dc |
|
339 |
+ */ |
|
340 |
+ public function insertEndElement(\DataContainer $dc) |
|
341 |
+ { |
|
342 |
+ $activeRecord = $dc->activeRecord; |
|
343 |
+ if (!$activeRecord) { |
|
344 |
+ return; |
|
345 |
+ } |
|
346 |
+ |
|
347 |
+ if ($activeRecord->type === 'swiperSliderStart' || $activeRecord->type === 'swiperSliderSlideStart') { |
|
348 |
+ |
|
349 |
+ // Find the next wrapper element |
|
350 |
+ $nextElement = \Database::getInstance() |
|
351 |
+ ->prepare(" |
|
352 |
+ SELECT type |
|
353 |
+ FROM tl_content |
|
354 |
+ WHERE pid = ? |
|
355 |
+ AND (ptable = ? OR ptable = ?) |
|
356 |
+ AND type IN ('swiperSliderSlideStart', 'swiperSliderSlideStop','swiperSliderStart', 'swiperSliderStop') |
|
357 |
+ AND sorting > ? |
|
358 |
+ ORDER BY sorting ASC |
|
359 |
+ LIMIT 1 |
|
360 |
+ ") |
|
361 |
+ ->execute( |
|
362 |
+ $activeRecord->pid, |
|
363 |
+ $activeRecord->ptable ?: 'tl_article', |
|
364 |
+ $activeRecord->ptable === 'tl_article' ? '' : $activeRecord->ptable, |
|
365 |
+ $activeRecord->sorting |
|
366 |
+ ); |
|
367 |
+ |
|
368 |
+ // Check if a stop element should be created |
|
369 |
+ if ( |
|
370 |
+ !$nextElement->type |
|
371 |
+ || ($activeRecord->type === 'swiperSliderStart' && ($nextElement->type === 'swiperSliderStart')) |
|
372 |
+ || ($activeRecord->type === 'swiperSliderSlideStart' && ($nextElement->type === 'swiperSliderSlideStart' || $nextElement->type === 'swiperSliderStart' || $nextElement->type === 'swiperSliderStop')) |
|
373 |
+ ) { |
|
374 |
+ \Database::getInstance() |
|
375 |
+ ->prepare('INSERT INTO tl_content %s') |
|
376 |
+ ->set(array( |
|
377 |
+ 'pid' => $activeRecord->pid, |
|
378 |
+ 'ptable' => $activeRecord->ptable ?: 'tl_article', |
|
379 |
+ 'type' => substr($activeRecord->type, 0, -5) . 'Stop', |
|
380 |
+ 'sorting' => $activeRecord->sorting + 1, |
|
381 |
+ 'tstamp' => time(), |
|
382 |
+ )) |
|
383 |
+ ->execute(); |
|
384 |
+ } |
|
385 |
+ |
|
386 |
+ } |
|
387 |
+ } |
|
388 |
+ |
|
389 |
+ /** |
|
390 |
+ * Dynamically add flags to the "multiSRC" field |
|
391 |
+ * |
|
392 |
+ * @param mixed $varValue |
|
393 |
+ * @param Contao\DataContainer $dc |
|
394 |
+ * |
|
395 |
+ * @return mixed |
|
396 |
+ */ |
|
397 |
+ public function setMultiSrcFlags($varValue, Contao\DataContainer $dc) |
|
398 |
+ { |
|
399 |
+ if ($dc->activeRecord) |
|
400 |
+ { |
|
401 |
+ switch ($dc->activeRecord->type) |
|
402 |
+ { |
|
403 |
+ case 'swiperSliderStart': |
|
404 |
+ case 'swiperSliderSlideStart': |
|
405 |
+ case 'swiperSliderImage': |
|
406 |
+ $GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['eval']['isGallery'] = true; |
|
407 |
+ $GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['eval']['extensions'] = Contao\Config::get('validImageTypes').'mp4,ogv,webm,mov'; |
|
408 |
+ break; |
|
409 |
+ } |
|
410 |
+ } |
|
411 |
+ return $varValue; |
|
412 |
+ } |
|
413 |
+} |
|
0 | 414 |
\ No newline at end of file |