... | ... |
@@ -28,7 +28,7 @@ ClassLoader::addClasses(array |
28 | 28 |
'eSM_slick\ContentSlickSliderStop' => 'system/modules/eSM_slick/elements/ContentSlickSliderStop.php', |
29 | 29 |
'eSM_slick\ContentSlickSliderSlideStart' => 'system/modules/eSM_slick/elements/ContentSlickSliderSlideStart.php', |
30 | 30 |
'eSM_slick\ContentSlickSliderSlideStop' => 'system/modules/eSM_slick/elements/ContentSlickSliderSlideStop.php', |
31 |
- 'eSM_slick\ContentSlickSliderWallpaper' => 'system/modules/eSM_slick/elements/ContentSlickSliderWallpaper.php', |
|
31 |
+ 'eSM_slick\ContentSlickSliderImage' => 'system/modules/eSM_slick/elements/ContentSlickSliderImage.php', |
|
32 | 32 |
)); |
33 | 33 |
|
34 | 34 |
|
... | ... |
@@ -42,5 +42,5 @@ TemplateLoader::addFiles(array |
42 | 42 |
'ce_slick_slider_stop' => 'system/modules/eSM_slick/templates/elements', |
43 | 43 |
'slide_start_default' => 'system/modules/eSM_slick/templates/slides', |
44 | 44 |
'slide_stop_default' => 'system/modules/eSM_slick/templates/slides', |
45 |
- 'ce_slick_slider_wallpaper' => 'system/modules/eSM_slick/templates/elements', |
|
45 |
+ 'ce_slick_slider_image' => 'system/modules/eSM_slick/templates/elements', |
|
46 | 46 |
)); |
... | ... |
@@ -23,7 +23,7 @@ $GLOBALS['TL_CTE']['slickSlider'] = array |
23 | 23 |
'slickSliderStop' => 'ContentSlickSliderStop', |
24 | 24 |
'slickSliderSlideStart'=> 'ContentSlickSliderSlideStart', |
25 | 25 |
'slickSliderSlideStop' => 'ContentSlickSliderSlideStop', |
26 |
- 'slickSliderWallpaper' => 'ContentSlickSliderWallpaper' |
|
26 |
+ 'slickSliderImage' => 'ContentSlickSliderImage' |
|
27 | 27 |
); |
28 | 28 |
|
29 | 29 |
/** |
... | ... |
@@ -23,14 +23,16 @@ $GLOBALS['TL_DCA']['tl_content']['config']['onsubmit_callback'][] = array('tl_co |
23 | 23 |
* Add palettes to tl_content |
24 | 24 |
*/ |
25 | 25 |
$GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][] = 'eSM_addImage'; |
26 |
+$GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][] = 'eSM_addText'; |
|
26 | 27 |
$GLOBALS['TL_DCA']['tl_content']['palettes']['slickSliderStart'] = '{type_legend},type;{slickSlider_legend},eSM_slick_autoPlaySpeed,eSM_slick_speed,eSM_slick_initialSlide,eSM_slick_lazyLoad,eSM_slick_slidesToShow,eSM_slick_slidesToScroll,eSM_slick_infinite,eSM_slick_arrows,eSM_slick_pagination,eSM_slick_pause,eSM_slick_fade,eSM_slick_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'; |
27 | 28 |
$GLOBALS['TL_DCA']['tl_content']['palettes']['slickSliderStop'] = '{type_legend},type;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests;{invisible_legend:hide},invisible,start,stop'; |
28 | 29 |
$GLOBALS['TL_DCA']['tl_content']['palettes']['slickSliderSlideStart'] = '{type_legend},type;{slickSlider_legend},eSM_addImage;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space;{invisible_legend:hide},invisible,start,stop'; |
29 | 30 |
$GLOBALS['TL_DCA']['tl_content']['palettes']['slickSliderSlideStop'] = '{type_legend},type;{protected_legend:hide},protected;{expert_legend:hide},guests;{invisible_legend:hide},invisible,start,stop'; |
30 |
-$GLOBALS['TL_DCA']['tl_content']['palettes']['slickSliderWallpaper'] = '{type_legend},type;{slickSlider_legend},eSM_slick_text,eSM_slick_url,singleSRC,size;{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']['slickSliderImage'] = '{type_legend},type;{slickSlider_legend},singleSRC,size,eSM_slick_bgSize,eSM_slick_bgPosition,eSM_slick_minHeight,eSM_slick_bgOpacity,eSM_slick_bgRepeat,eSM_addText;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space;{invisible_legend:hide},invisible,start,stop'; |
|
31 | 32 |
|
32 | 33 |
|
33 | 34 |
$GLOBALS['TL_DCA']['tl_content']['subpalettes']['eSM_addImage'] = 'singleSRC,size,eSM_slick_bgSize,eSM_slick_bgPosition,eSM_slick_minHeight,eSM_slick_bgOpacity,eSM_slick_bgRepeat'; |
35 |
+$GLOBALS['TL_DCA']['tl_content']['subpalettes']['eSM_addText'] = 'eSM_slick_text,eSM_slick_url'; |
|
34 | 36 |
|
35 | 37 |
/** |
36 | 38 |
* Add fields to tl_content |
... | ... |
@@ -179,6 +181,15 @@ $GLOBALS['TL_DCA']['tl_content']['fields']['eSM_addImage'] = array |
179 | 181 |
'sql' => "char(1) NOT NULL default ''" |
180 | 182 |
); |
181 | 183 |
|
184 |
+$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_addText'] = array |
|
185 |
+( |
|
186 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_addText'], |
|
187 |
+ 'exclude' => true, |
|
188 |
+ 'inputType' => 'checkbox', |
|
189 |
+ 'eval' => array('tl_class'=>'clr m12', 'submitOnChange'=>true), |
|
190 |
+ 'sql' => "char(1) NOT NULL default ''" |
|
191 |
+); |
|
192 |
+ |
|
182 | 193 |
$GLOBALS['TL_DCA']['tl_content']['fields']['eSM_slick_minHeight'] = array |
183 | 194 |
( |
184 | 195 |
'label' => &$GLOBALS['TL_LANG']['tl_content']['eSM_slick_minHeight'], |
185 | 196 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,88 @@ |
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 |
+namespace eSM_slick; |
|
12 |
+ |
|
13 |
+ |
|
14 |
+/** |
|
15 |
+ * Front end content element slick slider start. |
|
16 |
+ */ |
|
17 |
+class ContentSlickSliderImage extends \ContentElement |
|
18 |
+{ |
|
19 |
+ |
|
20 |
+ /** |
|
21 |
+ * Template |
|
22 |
+ * @var string |
|
23 |
+ */ |
|
24 |
+ protected $strTemplate = 'ce_slick_slider_image'; |
|
25 |
+ |
|
26 |
+ /** |
|
27 |
+ * Generate the content element |
|
28 |
+ */ |
|
29 |
+ protected function compile() |
|
30 |
+ { |
|
31 |
+ if (TL_MODE == 'BE') |
|
32 |
+ { |
|
33 |
+ $this->strTemplate = 'be_wildcard'; |
|
34 |
+ |
|
35 |
+ /** @var \BackendTemplate|object $objTemplate */ |
|
36 |
+ $objTemplate = new \BackendTemplate($this->strTemplate); |
|
37 |
+ |
|
38 |
+ $this->Template = $objTemplate; |
|
39 |
+ } |
|
40 |
+ |
|
41 |
+ if ($this->singleSRC) |
|
42 |
+ { |
|
43 |
+ |
|
44 |
+ $objFile = \FilesModel::findByUuid($this->singleSRC); |
|
45 |
+ |
|
46 |
+ if ($objFile !== null && is_file(TL_ROOT . '/' . $objFile->path)) |
|
47 |
+ { |
|
48 |
+ $this->singleSRC = $objFile->path; |
|
49 |
+ |
|
50 |
+ $this->addImageToTemplate($this->Template, array('singleSRC'=>$this->singleSRC, 'size'=>$this->size)); |
|
51 |
+ |
|
52 |
+ if ($this->eSM_slick_minHeight) { |
|
53 |
+ if ($this->eSM_slick_bgSize && $this->eSM_slick_bgSize == 'auto auto') { |
|
54 |
+ $this->Template->minHeight = $this->Template->picture['img']['height'] . 'px'; |
|
55 |
+ } else |
|
56 |
+ { |
|
57 |
+ $this->Template->minHeight = round($this->Template->picture['img']['height'] / $this->Template->picture['img']['width'] * 100) . '%'; |
|
58 |
+ } |
|
59 |
+ } |
|
60 |
+ } |
|
61 |
+ |
|
62 |
+ $backgroundStyle = 'background-image: url(\''.$this->Template->src.'\');'; |
|
63 |
+ |
|
64 |
+ if ($this->eSM_slick_bgSize) { |
|
65 |
+ $backgroundStyle .= 'background-size: ' . $this->eSM_slick_bgSize . ';'; |
|
66 |
+ } else { |
|
67 |
+ $backgroundStyle .= 'background-size: cover;'; |
|
68 |
+ } |
|
69 |
+ if ($this->eSM_slick_bgPosition) { |
|
70 |
+ $backgroundStyle .= 'background-position: ' . $this->eSM_slick_bgPosition . ';'; |
|
71 |
+ } else { |
|
72 |
+ $backgroundStyle .= 'background-position: 0 0;'; |
|
73 |
+ } |
|
74 |
+ if ($this->eSM_slick_bgOpacity) { |
|
75 |
+ $backgroundStyle .= 'opacity:' . $this->eSM_slick_bgOpacity/100 . ';'; |
|
76 |
+ } |
|
77 |
+ if ($this->eSM_slick_bgRepeat) { |
|
78 |
+ $backgroundStyle .= 'background-repeat: ' . $this->eSM_slick_bgRepeat . ';'; |
|
79 |
+ } |
|
80 |
+ |
|
81 |
+ $this->Template->backgroundStyle = $backgroundStyle; |
|
82 |
+ } |
|
83 |
+ |
|
84 |
+ $this->Template->text = nl2br($this->eSM_slick_text); |
|
85 |
+ |
|
86 |
+ } |
|
87 |
+ |
|
88 |
+} |
0 | 89 |
deleted file mode 100644 |
... | ... |
@@ -1,77 +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 |
-namespace eSM_slick; |
|
12 |
- |
|
13 |
- |
|
14 |
-/** |
|
15 |
- * Front end content element slick slider start. |
|
16 |
- */ |
|
17 |
-class ContentSlickSliderWallpaper extends \ContentElement |
|
18 |
-{ |
|
19 |
- |
|
20 |
- /** |
|
21 |
- * Template |
|
22 |
- * @var string |
|
23 |
- */ |
|
24 |
- protected $strTemplate = 'ce_slick_slider_wallpaper'; |
|
25 |
- |
|
26 |
- |
|
27 |
- public function generate() |
|
28 |
- { |
|
29 |
- if ($this->singleSRC == '') |
|
30 |
- { |
|
31 |
- return ''; |
|
32 |
- } |
|
33 |
- |
|
34 |
- $objFile = \FilesModel::findByUuid($this->singleSRC); |
|
35 |
- |
|
36 |
- if ($objFile === null) |
|
37 |
- { |
|
38 |
- if (!\Validator::isUuid($this->singleSRC)) |
|
39 |
- { |
|
40 |
- return '<p class="error">'.$GLOBALS['TL_LANG']['ERR']['version2format'].'</p>'; |
|
41 |
- } |
|
42 |
- |
|
43 |
- return ''; |
|
44 |
- } |
|
45 |
- |
|
46 |
- if (!is_file(TL_ROOT . '/' . $objFile->path)) |
|
47 |
- { |
|
48 |
- return ''; |
|
49 |
- } |
|
50 |
- |
|
51 |
- $this->singleSRC = $objFile->path; |
|
52 |
- |
|
53 |
- return parent::generate(); |
|
54 |
- } |
|
55 |
- |
|
56 |
- |
|
57 |
- /** |
|
58 |
- * Generate the content element |
|
59 |
- */ |
|
60 |
- protected function compile() |
|
61 |
- { |
|
62 |
- if (TL_MODE == 'BE') |
|
63 |
- { |
|
64 |
- $this->strTemplate = 'ce_image'; |
|
65 |
- |
|
66 |
- /** @var \BackendTemplate|object $objTemplate */ |
|
67 |
- $objTemplate = new \BackendTemplate($this->strTemplate); |
|
68 |
- |
|
69 |
- $this->Template = $objTemplate; |
|
70 |
- } |
|
71 |
- |
|
72 |
- $GLOBALS['TL_CSS'][] = '/system/modules/eSM_slick/assets/css/slick-wallpaper.css'; |
|
73 |
- |
|
74 |
- $this->addImageToTemplate($this->Template, $this->arrData); |
|
75 |
- $this->Template->text = nl2br($this->eSM_slick_text); |
|
76 |
- } |
|
77 |
-} |
... | ... |
@@ -18,8 +18,8 @@ $GLOBALS['TL_LANG']['CTE']['slickSliderSlideStart'][0] = "Slide Anfang"; |
18 | 18 |
$GLOBALS['TL_LANG']['CTE']['slickSliderSlideStart'][1] = "Beginn eines Slides über mehrere Inhaltselemente."; |
19 | 19 |
$GLOBALS['TL_LANG']['CTE']['slickSliderSlideStop'][0] = "Slide Ende"; |
20 | 20 |
$GLOBALS['TL_LANG']['CTE']['slickSliderSlideStop'][1] = "Ende eines Slides über mehrere Inhaltselemente."; |
21 |
-$GLOBALS['TL_LANG']['CTE']['slickSliderWallpaper'][0] = "Wallpaper-Slide"; |
|
22 |
-$GLOBALS['TL_LANG']['CTE']['slickSliderWallpaper'][1] = "Ein Slide mit einer Wallpapergrafik im Hintergrund und der Möglichkeit einen Text zu platzieren."; |
|
21 |
+$GLOBALS['TL_LANG']['CTE']['slickSliderImage'][0] = "Bild-Slide"; |
|
22 |
+$GLOBALS['TL_LANG']['CTE']['slickSliderImage'][1] = "Ein Slide mit einem Bild und der Möglichkeit einen Text zu platzieren."; |
|
23 | 23 |
|
24 | 24 |
$GLOBALS['TL_LANG']['MSC']['slick_lazyLoad']['ondemand'] = 'Bei Bedarf'; |
25 | 25 |
$GLOBALS['TL_LANG']['MSC']['slick_lazyLoad']['progressive'] = 'Fortlaufend'; |
26 | 26 |
\ No newline at end of file |
... | ... |
@@ -48,6 +48,8 @@ $GLOBALS['TL_LANG']['tl_content']['eSM_slick_bgOpacity'][0] = "Hintergrundb |
48 | 48 |
$GLOBALS['TL_LANG']['tl_content']['eSM_slick_bgOpacity'][1] = "Die Transparenz des Hintergrundbildes."; |
49 | 49 |
$GLOBALS['TL_LANG']['tl_content']['eSM_slick_bgRepeat'][0] = "Hintergrundbildwiederholung"; |
50 | 50 |
$GLOBALS['TL_LANG']['tl_content']['eSM_slick_bgRepeat'][1] = "Legt fest ob das Hintergrundbild wiederholt werden soll."; |
51 |
+$GLOBALS['TL_LANG']['tl_content']['eSM_addText'][0] = "Ein Text hinzufügen"; |
|
52 |
+$GLOBALS['TL_LANG']['tl_content']['eSM_addText'][1] = "Dem Bild-Slide ein Text hinzufügen."; |
|
51 | 53 |
/** |
52 | 54 |
* Legends |
53 | 55 |
*/ |
... | ... |
@@ -18,8 +18,8 @@ $GLOBALS['TL_LANG']['CTE']['slickSliderSlideStart'][0] = "Slide start"; |
18 | 18 |
$GLOBALS['TL_LANG']['CTE']['slickSliderSlideStart'][1] = "Beginning of a single slide."; |
19 | 19 |
$GLOBALS['TL_LANG']['CTE']['slickSliderSlideStop'][0] = "Slide stop"; |
20 | 20 |
$GLOBALS['TL_LANG']['CTE']['slickSliderSlideStop'][1] = "Ending of a single slide."; |
21 |
-$GLOBALS['TL_LANG']['CTE']['slickSliderWallpaper'][0] = "Wallpaper slide"; |
|
22 |
-$GLOBALS['TL_LANG']['CTE']['slickSliderWallpaper'][1] = "Special type of slide with background image and the option to place a text on it."; |
|
21 |
+$GLOBALS['TL_LANG']['CTE']['slickSliderImage'][0] = "Image slide"; |
|
22 |
+$GLOBALS['TL_LANG']['CTE']['slickSliderImage'][1] = "Image slide with the option to place a text on it."; |
|
23 | 23 |
|
24 | 24 |
$GLOBALS['TL_LANG']['MSC']['slick_lazyLoad']['ondemand'] = 'On demand'; |
25 | 25 |
$GLOBALS['TL_LANG']['MSC']['slick_lazyLoad']['progressive'] = 'Progressive'; |
26 | 26 |
\ No newline at end of file |
... | ... |
@@ -48,6 +48,8 @@ $GLOBALS['TL_LANG']['tl_content']['eSM_slick_bgOpacity'][0] = "Background i |
48 | 48 |
$GLOBALS['TL_LANG']['tl_content']['eSM_slick_bgOpacity'][1] = "The opacity of the background image."; |
49 | 49 |
$GLOBALS['TL_LANG']['tl_content']['eSM_slick_bgRepeat'][0] = "Background image repetition."; |
50 | 50 |
$GLOBALS['TL_LANG']['tl_content']['eSM_slick_bgRepeat'][1] = "Defines if the background image is meant to be repeated."; |
51 |
+$GLOBALS['TL_LANG']['tl_content']['eSM_addText'][0] = "Add text"; |
|
52 |
+$GLOBALS['TL_LANG']['tl_content']['eSM_addText'][1] = "Add a text to the image slide."; |
|
51 | 53 |
/** |
52 | 54 |
* Legends |
53 | 55 |
*/ |
54 | 56 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,20 @@ |
1 |
+ |
|
2 |
+<?php $this->block('content'); ?> |
|
3 |
+ |
|
4 |
+<div class="slick-slider-slide slide_<?= $this->id ?>"> |
|
5 |
+ <?php if ($this->src): ?> |
|
6 |
+ <div class="slick-slider-slide-image" style="<?= $this->backgroundStyle ?>"></div> |
|
7 |
+ <?php if ($this->minHeight): ?> |
|
8 |
+ <style>.slide_<?= $this->id ?>:before { content: ""; display: block; padding-top: <?= $this->minHeight ?>; float: left; }</style> |
|
9 |
+ <?php endif; ?> |
|
10 |
+ <?php endif; ?> |
|
11 |
+ <div class="slide-content"> |
|
12 |
+ |
|
13 |
+ <?php if ($this->text): ?> |
|
14 |
+ <span class="slide-text"><?= $this->text ?></span> |
|
15 |
+ <?php endif; ?> |
|
16 |
+ |
|
17 |
+ </div> |
|
18 |
+</div> |
|
19 |
+ |
|
20 |
+<?php $this->endblock(); ?> |
0 | 21 |
deleted file mode 100644 |
... | ... |
@@ -1,8 +0,0 @@ |
1 |
- |
|
2 |
-<div class="<?= $this->class ?> wallpaper-slide block"<?= $this->cssID ?> style="<?php if ($this->style): ?><?= $this->style ?> <?php endif; ?>background-image: url('<?= $this->picture['img']['src'] ?>');"> |
|
3 |
- |
|
4 |
- <?php if ($this->text): ?> |
|
5 |
- <span class="wallpaper-text"><?= $this->text ?></span> |
|
6 |
- <?php endif; ?> |
|
7 |
- |
|
8 |
-</div> |