Browse code

Initial commit

Benjamin Roth authored on15/03/2023 23:50:38
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,54 @@
1
+<?php
2
+
3
+/*
4
+ * This file is part of newsmailer bundle for Contao.
5
+ *
6
+ * (c) Benjamin Roth
7
+ *
8
+ * @license LGPL-3.0-or-later
9
+ */
10
+
11
+use Contao\CoreBundle\DataContainer\PaletteManipulator;
12
+
13
+/**
14
+ * Palettes
15
+ */
16
+
17
+PaletteManipulator::create()
18
+    ->addLegend('nc_legend','protected_legend',PaletteManipulator::POSITION_BEFORE)
19
+    ->addField('nc_enable','nc_legend', PaletteManipulator::POSITION_APPEND)
20
+    ->applyToPalette('default','tl_news_archive')
21
+;
22
+$GLOBALS['TL_DCA']['tl_news_archive']['palettes']['__selector__'][] = 'nc_enable';
23
+$GLOBALS['TL_DCA']['tl_news_archive']['subpalettes']['nc_enable'] = 'nc_notification,nc_notification_groups';
24
+
25
+
26
+/**
27
+ * Fields
28
+ */
29
+
30
+$GLOBALS['TL_DCA']['tl_news_archive']['fields']['nc_enable'] = array
31
+(
32
+    'exclude'                 => true,
33
+    'inputType'               => 'checkbox',
34
+    'eval'                    => array('tl_class'=>'w50 m12','submitOnChange'=>true),
35
+    'sql'                     => "char(1) NOT NULL default ''"
36
+);
37
+
38
+$GLOBALS['TL_DCA']['tl_news_archive']['fields']['nc_notification_groups'] = array
39
+(
40
+    'exclude'                 => true,
41
+    'inputType'               => 'checkbox',
42
+    'foreignKey'              => 'tl_member_group.name',
43
+    'eval'                    => array('mandatory'=>true, 'multiple'=>true,'tl_class'=>'clr'),
44
+    'sql'                     => "blob NULL",
45
+    'relation'                => array('type'=>'hasMany', 'load'=>'lazy')
46
+);
47
+
48
+$GLOBALS['TL_DCA']['tl_news_archive']['fields']['nc_notification'] = array
49
+(
50
+    'exclude'                   => true,
51
+    'inputType'                 => 'select',
52
+    'eval'                      => array('mandatory'=>true,'includeBlankOption'=>true, 'chosen'=>true, 'tl_class'=>'w50'),
53
+    'sql'                       => "int(10) unsigned NOT NULL default '0'"
54
+);