Browse code

Support rootfallback palette

Benjamin Roth authored on05/04/2020 11:44:32
Showing1 changed files
... ...
@@ -13,6 +13,9 @@
13 13
  */
14 14
 $GLOBALS['TL_DCA']['tl_page']['palettes']['__selector__'][] = 'cookieconsent_enable';
15 15
 $GLOBALS['TL_DCA']['tl_page']['palettes']['root'] .= ';{cookieconsent_legend},cookieconsent_enable';
16
+if (isset($GLOBALS['TL_DCA']['tl_page']['palettes']['rootfallback'])) {
17
+  $GLOBALS['TL_DCA']['tl_page']['palettes']['rootfallback'] .= ';{cookieconsent_legend},cookieconsent_enable';
18
+}
16 19
 
17 20
 $GLOBALS['TL_DCA']['tl_page']['subpalettes']['cookieconsent_enable'] = 'cookieconsent_link,cookieconsent_services,cookieconsent_categories_custom,cookieconsent_services_custom';
18 21
 
Browse code

Add explanation for service config and references for preset services

Benjamin Roth authored on12/12/2019 11:09:38
Showing1 changed files
... ...
@@ -48,6 +48,7 @@ $GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_services'] = array
48 48
   'exclude' => true,
49 49
   'inputType' => 'checkbox',
50 50
   'options' => array('analytics','matomo'),
51
+  'reference' => &$GLOBALS['TL_LANG']['REF']['tl_page']['cookieconsent_services'],
51 52
   'eval' => array('multiple'=>true, 'tl_class' => 'clr'),
52 53
   'sql' => "blob NULL",
53 54
 );
... ...
@@ -58,7 +59,7 @@ $GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_categories_custom'] = arr
58 59
   'exclude' => true,
59 60
   'inputType' => 'textarea',
60 61
   'explanation' => 'cookieconsent_categories',
61
-  'eval' => array('allowHtml'=>true, 'class'=>'monospace', 'rte'=>'ace|javascript', 'tl_class'=>'clr'),
62
+  'eval' => array('allowHtml'=>true, 'class'=>'monospace', 'rte'=>'ace|javascript', 'tl_class'=>'clr', 'helpwizard'=>true),
62 63
   'sql'=> "mediumtext NULL"
63 64
 );
64 65
 
... ...
@@ -67,7 +68,8 @@ $GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_services_custom'] = array
67 68
   'label' => &$GLOBALS['TL_LANG']['tl_page']['cookieconsent_services_custom'],
68 69
   'exclude' => true,
69 70
   'inputType' => 'textarea',
70
-  'eval' => array('allowHtml'=>true, 'class'=>'monospace', 'rte'=>'ace|javascript', 'tl_class'=>'clr'),
71
+  'explanation' => 'cookieconsent_services',
72
+  'eval' => array('allowHtml'=>true, 'class'=>'monospace', 'rte'=>'ace|javascript', 'tl_class'=>'clr', 'helpwizard'=>true),
71 73
   'sql'=> "mediumtext NULL"
72 74
 );
73 75
 
Browse code

Add explanation for category config

Benjamin Roth authored on12/12/2019 11:00:51
Showing1 changed files
... ...
@@ -57,6 +57,7 @@ $GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_categories_custom'] = arr
57 57
   'label' => &$GLOBALS['TL_LANG']['tl_page']['cookieconsent_categories_custom'],
58 58
   'exclude' => true,
59 59
   'inputType' => 'textarea',
60
+  'explanation' => 'cookieconsent_categories',
60 61
   'eval' => array('allowHtml'=>true, 'class'=>'monospace', 'rte'=>'ace|javascript', 'tl_class'=>'clr'),
61 62
   'sql'=> "mediumtext NULL"
62 63
 );
Browse code

Fix wrong set labels

Benjamin Roth authored on12/12/2019 10:04:17
Showing1 changed files
... ...
@@ -54,7 +54,7 @@ $GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_services'] = array
54 54
 
55 55
 $GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_categories_custom'] = array
56 56
 (
57
-  'label' => &$GLOBALS['TL_LANG']['tl_page']['cookieconsent_services_custom'],
57
+  'label' => &$GLOBALS['TL_LANG']['tl_page']['cookieconsent_categories_custom'],
58 58
   'exclude' => true,
59 59
   'inputType' => 'textarea',
60 60
   'eval' => array('allowHtml'=>true, 'class'=>'monospace', 'rte'=>'ace|javascript', 'tl_class'=>'clr'),
Browse code

Add more configuration possibilities and make use of template blocks

Benjamin Roth authored on12/12/2019 09:59:34
Showing1 changed files
... ...
@@ -14,20 +14,22 @@
14 14
 $GLOBALS['TL_DCA']['tl_page']['palettes']['__selector__'][] = 'cookieconsent_enable';
15 15
 $GLOBALS['TL_DCA']['tl_page']['palettes']['root'] .= ';{cookieconsent_legend},cookieconsent_enable';
16 16
 
17
-$GLOBALS['TL_DCA']['tl_page']['subpalettes']['cookieconsent_enable'] = 'cookieconsent_link,cookieconsent_services';
17
+$GLOBALS['TL_DCA']['tl_page']['subpalettes']['cookieconsent_enable'] = 'cookieconsent_link,cookieconsent_services,cookieconsent_categories_custom,cookieconsent_services_custom';
18 18
 
19 19
 /*
20 20
  * Add the fields
21 21
  */
22
-$GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_enable'] = [
22
+$GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_enable'] = array
23
+(
23 24
   'label' => &$GLOBALS['TL_LANG']['tl_page']['cookieconsent_enable'],
24 25
   'exclude' => true,
25 26
   'inputType' => 'checkbox',
26 27
   'eval' => array('submitOnChange' => true, 'tl_class' => 'clr'),
27 28
   'sql' => "char(1) NOT NULL default ''",
28
-];
29
+);
29 30
 
30
-$GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_link'] = [
31
+$GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_link'] = array
32
+(
31 33
   'label' => &$GLOBALS['TL_LANG']['tl_page']['cookieconsent_link'],
32 34
   'exclude' => true,
33 35
   'search' => true,
... ...
@@ -38,16 +40,35 @@ $GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_link'] = [
38 40
     array('tl_content_cookieconsent', 'pagePicker')
39 41
   ),
40 42
   'sql'=> "varchar(255) NOT NULL default ''"
41
-];
43
+);
42 44
 
43
-$GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_services'] = [
45
+$GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_services'] = array
46
+(
44 47
   'label' => &$GLOBALS['TL_LANG']['tl_page']['cookieconsent_services'],
45 48
   'exclude' => true,
46 49
   'inputType' => 'checkbox',
47 50
   'options' => array('analytics','matomo'),
48 51
   'eval' => array('multiple'=>true, 'tl_class' => 'clr'),
49 52
   'sql' => "blob NULL",
50
-];
53
+);
54
+
55
+$GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_categories_custom'] = array
56
+(
57
+  'label' => &$GLOBALS['TL_LANG']['tl_page']['cookieconsent_services_custom'],
58
+  'exclude' => true,
59
+  'inputType' => 'textarea',
60
+  'eval' => array('allowHtml'=>true, 'class'=>'monospace', 'rte'=>'ace|javascript', 'tl_class'=>'clr'),
61
+  'sql'=> "mediumtext NULL"
62
+);
63
+
64
+$GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_services_custom'] = array
65
+(
66
+  'label' => &$GLOBALS['TL_LANG']['tl_page']['cookieconsent_services_custom'],
67
+  'exclude' => true,
68
+  'inputType' => 'textarea',
69
+  'eval' => array('allowHtml'=>true, 'class'=>'monospace', 'rte'=>'ace|javascript', 'tl_class'=>'clr'),
70
+  'sql'=> "mediumtext NULL"
71
+);
51 72
 
52 73
 class tl_content_cookieconsent extends Backend
53 74
 {
Browse code

Fix some more dca stuff

Benjamin Roth authored on11/12/2019 22:34:34
Showing1 changed files
... ...
@@ -14,7 +14,7 @@
14 14
 $GLOBALS['TL_DCA']['tl_page']['palettes']['__selector__'][] = 'cookieconsent_enable';
15 15
 $GLOBALS['TL_DCA']['tl_page']['palettes']['root'] .= ';{cookieconsent_legend},cookieconsent_enable';
16 16
 
17
-$GLOBALS['TL_DCA']['tl_page']['subpalettes']['cookieconsent_enable'] = 'cookieconsent_link,cookieconsent_statistics_analytics';
17
+$GLOBALS['TL_DCA']['tl_page']['subpalettes']['cookieconsent_enable'] = 'cookieconsent_link,cookieconsent_services';
18 18
 
19 19
 /*
20 20
  * Add the fields
... ...
@@ -32,7 +32,7 @@ $GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_link'] = [
32 32
   'exclude' => true,
33 33
   'search' => true,
34 34
   'inputType' => 'text',
35
-  'eval' => array('rgxp'=>'url', 'decodeEntities'=>true, 'maxlength'=>255, 'fieldType'=>'radio', 'tl_class'=>'clr wizard'),
35
+  'eval' => array('rgxp'=>'url', 'decodeEntities'=>true, 'maxlength'=>255, 'fieldType'=>'radio', 'tl_class'=>'clr w50 wizard'),
36 36
   'wizard' => array
37 37
   (
38 38
     array('tl_content_cookieconsent', 'pagePicker')
Browse code

Add missing pagePicker function

Benjamin Roth authored on11/12/2019 22:32:16
Showing1 changed files
... ...
@@ -35,7 +35,7 @@ $GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_link'] = [
35 35
   'eval' => array('rgxp'=>'url', 'decodeEntities'=>true, 'maxlength'=>255, 'fieldType'=>'radio', 'tl_class'=>'clr wizard'),
36 36
   'wizard' => array
37 37
   (
38
-    array('tl_content', 'pagePicker')
38
+    array('tl_content_cookieconsent', 'pagePicker')
39 39
   ),
40 40
   'sql'=> "varchar(255) NOT NULL default ''"
41 41
 ];
... ...
@@ -48,3 +48,18 @@ $GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_services'] = [
48 48
   'eval' => array('multiple'=>true, 'tl_class' => 'clr'),
49 49
   'sql' => "blob NULL",
50 50
 ];
51
+
52
+class tl_content_cookieconsent extends Backend
53
+{
54
+  /**
55
+   * Return the link picker wizard
56
+   *
57
+   * @param \DataContainer $dc
58
+   *
59
+   * @return string
60
+   */
61
+  public function pagePicker(\DataContainer $dc)
62
+  {
63
+    return ' <a href="' . (($dc->value == '' || strpos($dc->value, '{{link_url::') !== false) ? 'contao/page.php' : 'contao/file.php') . '?do=' . \Input::get('do') . '&amp;table=' . $dc->table . '&amp;field=' . $dc->field . '&amp;value=' . rawurlencode(str_replace(array('{{link_url::', '}}'), '', $dc->value)) . '&amp;switch=1' . '" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['pagepicker']) . '" onclick="Backend.getScrollOffset();Backend.openModalSelector({\'width\':768,\'title\':\'' . specialchars(str_replace("'", "\\'", $GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['label'][0])) . '\',\'url\':this.href,\'id\':\'' . $dc->field . '\',\'tag\':\'ctrl_'. $dc->field . ((\Input::get('act') == 'editAll') ? '_' . $dc->id : '') . '\',\'self\':this});return false">' . \Image::getHtml('pickpage.gif', $GLOBALS['TL_LANG']['MSC']['pagepicker'], 'style="vertical-align:top;cursor:pointer"') . '</a>';
64
+  }
65
+}
Browse code

Use blob for service selection field

Benjamin Roth authored on11/12/2019 22:01:14
Showing1 changed files
... ...
@@ -45,6 +45,6 @@ $GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_services'] = [
45 45
   'exclude' => true,
46 46
   'inputType' => 'checkbox',
47 47
   'options' => array('analytics','matomo'),
48
-  'eval' => array('tl_class' => 'clr'),
49
-  'sql' => "char(1) NOT NULL default ''",
48
+  'eval' => array('multiple'=>true, 'tl_class' => 'clr'),
49
+  'sql' => "blob NULL",
50 50
 ];
Browse code

Add dca fields for settings and translations

Benjamin Roth authored on11/12/2019 21:56:05
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,50 @@
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
+ * Extend the palettes.
13
+ */
14
+$GLOBALS['TL_DCA']['tl_page']['palettes']['__selector__'][] = 'cookieconsent_enable';
15
+$GLOBALS['TL_DCA']['tl_page']['palettes']['root'] .= ';{cookieconsent_legend},cookieconsent_enable';
16
+
17
+$GLOBALS['TL_DCA']['tl_page']['subpalettes']['cookieconsent_enable'] = 'cookieconsent_link,cookieconsent_statistics_analytics';
18
+
19
+/*
20
+ * Add the fields
21
+ */
22
+$GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_enable'] = [
23
+  'label' => &$GLOBALS['TL_LANG']['tl_page']['cookieconsent_enable'],
24
+  'exclude' => true,
25
+  'inputType' => 'checkbox',
26
+  'eval' => array('submitOnChange' => true, 'tl_class' => 'clr'),
27
+  'sql' => "char(1) NOT NULL default ''",
28
+];
29
+
30
+$GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_link'] = [
31
+  'label' => &$GLOBALS['TL_LANG']['tl_page']['cookieconsent_link'],
32
+  'exclude' => true,
33
+  'search' => true,
34
+  'inputType' => 'text',
35
+  'eval' => array('rgxp'=>'url', 'decodeEntities'=>true, 'maxlength'=>255, 'fieldType'=>'radio', 'tl_class'=>'clr wizard'),
36
+  'wizard' => array
37
+  (
38
+    array('tl_content', 'pagePicker')
39
+  ),
40
+  'sql'=> "varchar(255) NOT NULL default ''"
41
+];
42
+
43
+$GLOBALS['TL_DCA']['tl_page']['fields']['cookieconsent_services'] = [
44
+  'label' => &$GLOBALS['TL_LANG']['tl_page']['cookieconsent_services'],
45
+  'exclude' => true,
46
+  'inputType' => 'checkbox',
47
+  'options' => array('analytics','matomo'),
48
+  'eval' => array('tl_class' => 'clr'),
49
+  'sql' => "char(1) NOT NULL default ''",
50
+];