Browse code

Refactor and rewrite as contao bundle

Benjamin Roth authored on04/11/2022 22:32:32
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,62 @@
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 EsalesMedia\ContaoSwiperBundle\Frontend\Element;
12
+
13
+
14
+/**
15
+ * Front end content element swiper slider end.
16
+ */
17
+class ContentSwiperSliderStop extends \ContentElement
18
+{
19
+
20
+	/**
21
+	 * Template
22
+	 * @var string
23
+	 */
24
+	protected $strTemplate = 'ce_swiper_slider_stop';
25
+
26
+  public function generate()
27
+  {
28
+    if (TL_MODE === 'BE') {
29
+      return parent::generate();
30
+    }
31
+
32
+    $parentKey = ($this->arrData['ptable'] ?: 'tl_article') . '__' . $this->arrData['pid'];
33
+
34
+    if (isset($GLOBALS['TL_ESM_SLICK'][$parentKey])) {
35
+      unset($GLOBALS['TL_ESM_SLICK'][$parentKey]);
36
+    }
37
+
38
+    if (!empty($GLOBALS['TL_ESM_SLICK_STACK'][$parentKey])) {
39
+      $GLOBALS['TL_ESM_SLICK'][$parentKey] = array_pop($GLOBALS['TL_ESM_SLICK_STACK'][$parentKey]);
40
+    }
41
+
42
+    return parent::generate();
43
+  }
44
+
45
+
46
+  /**
47
+	 * Generate the content element
48
+	 */
49
+	protected function compile()
50
+	{
51
+		if (TL_MODE == 'BE')
52
+		{
53
+			$this->strTemplate = 'be_wildcard';
54
+
55
+			/** @var \BackendTemplate|object $objTemplate */
56
+			$objTemplate = new \BackendTemplate($this->strTemplate);
57
+
58
+			$this->Template = $objTemplate;
59
+			$this->Template->title = $this->headline;
60
+		}
61
+	}
62
+}