Browse code

Add inserttags for opening settings

Benjamin Roth authored on12/12/2019 10:41:50
Showing4 changed files
... ...
@@ -11,4 +11,5 @@
11 11
 /**
12 12
  * Hooks.
13 13
  */
14
-$GLOBALS['TL_HOOKS']['outputFrontendTemplate'][] = ['EsalesMedia\Cookieconsent\EventListener\TemplateListener', 'onOutputFrontendTemplate'];
15 14
\ No newline at end of file
15
+$GLOBALS['TL_HOOKS']['outputFrontendTemplate'][] = array('EsalesMedia\Cookieconsent\EventListener\TemplateListener', 'onOutputFrontendTemplate');
16
+$GLOBALS['TL_HOOKS']['replaceInsertTags'][] = array('EsalesMedia\Cookieconsent\EventListener\InsertTagsListener', 'onReplaceInsertTags');
16 17
\ No newline at end of file
17 18
new file mode 100644
... ...
@@ -0,0 +1,15 @@
1
+<?php
2
+
3
+/*
4
+* This file is part of eSales Media cookieconsent module
5
+*
6
+* (c) Benjamin Roth
7
+*
8
+* @license https://www.gnu.org/licenses/gpl-3.0.html GPL
9
+*/
10
+
11
+/**
12
+ * Miscellaneous
13
+ */
14
+$GLOBALS['TL_LANG']['MSC']['cookieconsent_settings'] = array('Cookie-Einwilligung Einstellungen');
15
+
0 16
new file mode 100644
... ...
@@ -0,0 +1,15 @@
1
+<?php
2
+
3
+/*
4
+* This file is part of eSales Media cookieconsent module
5
+*
6
+* (c) Benjamin Roth
7
+*
8
+* @license https://www.gnu.org/licenses/gpl-3.0.html GPL
9
+*/
10
+
11
+/**
12
+ * Miscellaneous
13
+ */
14
+$GLOBALS['TL_LANG']['MSC']['cookieconsent_settings'] = array('Cookie consent settings');
15
+
0 16
new file mode 100644
... ...
@@ -0,0 +1,39 @@
1
+<?php
2
+
3
+/*
4
+* This file is part of eSales Media cookieconsent module
5
+*
6
+* (c) Benjamin Roth
7
+*
8
+* @license https://www.gnu.org/licenses/gpl-3.0.html GPL
9
+*/
10
+
11
+namespace EsalesMedia\Cookieconsent\EventListener;
12
+
13
+class InsertTagsListener
14
+{
15
+    /**
16
+     * Add custom regex for field validation
17
+     *
18
+     * @param $strRegexp
19
+     * @param $varValue
20
+     * @param \Widget $objWidget
21
+     * @return bool
22
+     */
23
+  public function onReplaceInsertTags(string $insertTag, bool $useCache, string $cachedValue, array $flags, array $tags, array $cache, int $_rit, int $_cnt)
24
+  {
25
+    switch ($insertTag)
26
+    {
27
+      case 'cc_edit':
28
+        return '<a class="ccb__edit" href="{{env::request}}#">' . $GLOBALS['TL_LANG']['MSC']['cookieconsent_settings'] . '</a>';
29
+
30
+      case 'cc_edit_open':
31
+        return '<a class="ccb__edit" href="{{env::request}}#">';
32
+
33
+      case 'cc_edit_close':
34
+        return '</a>';
35
+    }
36
+
37
+    return false;
38
+  }
39
+}