Browse code

Add table basics

Benjamin Roth authored on09/01/2023 23:48:14
Showing4 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,17 @@
1
+<?php
2
+
3
+declare(strict_types=1);
4
+
5
+/*
6
+ * This file is part of modal bundle for Contao.
7
+ *
8
+ * (c) Benjamin Roth
9
+ *
10
+ * @license LGPL-3.0-or-later
11
+ */
12
+
13
+
14
+$GLOBALS['BE_MOD']['content']['modals'] = array
15
+(
16
+    'tables'      => array('tl_vr_modal', 'tl_content'),
17
+);
0 18
new file mode 100644
... ...
@@ -0,0 +1,151 @@
1
+<?php
2
+
3
+declare(strict_types=1);
4
+
5
+/*
6
+ * This file is part of modal bundle for Contao.
7
+ *
8
+ * (c) Benjamin Roth
9
+ *
10
+ * @license LGPL-3.0-or-later
11
+ */
12
+
13
+use Contao\DC_Table;
14
+use Contao\DataContainer;
15
+
16
+$GLOBALS['TL_DCA']['tl_vr_modal'] = array
17
+(
18
+    'config' => array
19
+    (
20
+        'dataContainer'               => DC_Table::class,
21
+        'ctable'                      => array('tl_content'),
22
+        'switchToEdit'                => true,
23
+        'enableVersioning'            => true,
24
+        'markAsCopy'                  => 'name',
25
+        'sql' => array
26
+        (
27
+            'keys' => array
28
+            (
29
+                'id' => 'primary'
30
+            )
31
+        )
32
+    ),
33
+    'list' => array
34
+    (
35
+        'sorting' => array
36
+        (
37
+            'mode'                    => DataContainer::MODE_SORTABLE,
38
+            'fields'                  => array('tstamp DESC'),
39
+            'panelLayout'             => 'filter;sort,search,limit',
40
+        ),
41
+        'label' => array
42
+        (
43
+            'fields' => array('title'),
44
+            'format' => '%s',
45
+        ),
46
+        'global_operations' => array
47
+        (
48
+            'all' => array
49
+            (
50
+                'href'                => 'act=select',
51
+                'class'               => 'header_edit_all',
52
+                'attributes'          => 'onclick="Backend.getScrollOffset()" accesskey="e"'
53
+            )
54
+        ),
55
+        'operations' => array
56
+        (
57
+            'edit' => array
58
+            (
59
+                'href'                => 'table=tl_content',
60
+                'icon'                => 'edit.svg'
61
+            ),
62
+            'editheader' => array
63
+            (
64
+                'href'                => 'act=edit',
65
+                'icon'                => 'header.svg'
66
+            ),
67
+            'copy' => array
68
+            (
69
+                'href'                => 'act=copy',
70
+                'icon'                => 'copy.svg'
71
+            ),
72
+            'delete' => array
73
+            (
74
+                'href'                => 'act=delete',
75
+                'icon'                => 'delete.svg',
76
+                'attributes'          => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? null) . '\'))return false;Backend.getScrollOffset()"'
77
+            ),
78
+            'toggle' => array
79
+            (
80
+                'href'                => 'act=toggle&amp;field=published',
81
+                'icon'                => 'visible.svg',
82
+                'showInHeader'        => true
83
+            ),
84
+            'show' => array
85
+            (
86
+                'href'                => 'act=show',
87
+                'icon'                => 'show.svg'
88
+            )
89
+        )
90
+    ),
91
+    'palettes' => array
92
+    (
93
+        '__selector__'                => array(''),
94
+        'default'                     => '{title_legend},title;{publish_legend},published,start,stop'
95
+    ),
96
+    'subpalettes' => array
97
+    (
98
+
99
+    ),
100
+    'fields' => array
101
+    (
102
+        'id' => array
103
+        (
104
+            'sql'                     => "int(10) unsigned NOT NULL auto_increment"
105
+        ),
106
+        'pid' => array
107
+        (
108
+            'foreignKey'              => 'tl_news_archive.title',
109
+            'sql'                     => "int(10) unsigned NOT NULL default 0",
110
+            'relation'                => array('type'=>'belongsTo', 'load'=>'lazy')
111
+        ),
112
+        'tstamp' => array
113
+        (
114
+            'sql'                     => "int(10) unsigned NOT NULL default 0"
115
+        ),
116
+        'title' => array
117
+        (
118
+            'exclude'                 => true,
119
+            'search'                  => true,
120
+            'sorting'                 => true,
121
+            'flag'                    => DataContainer::SORT_INITIAL_LETTER_ASC,
122
+            'inputType'               => 'text',
123
+            'eval'                    => array('mandatory'=>true, 'maxlength'=>255, 'tl_class'=>'w50'),
124
+            'sql'                     => "varchar(255) NOT NULL default ''"
125
+        ),
126
+        'published' => array
127
+        (
128
+            'exclude'                 => true,
129
+            'toggle'                  => true,
130
+            'filter'                  => true,
131
+            'flag'                    => DataContainer::SORT_INITIAL_LETTER_ASC,
132
+            'inputType'               => 'checkbox',
133
+            'eval'                    => array('doNotCopy'=>true),
134
+            'sql'                     => "char(1) NOT NULL default ''"
135
+        ),
136
+        'start' => array
137
+        (
138
+            'exclude'                 => true,
139
+            'inputType'               => 'text',
140
+            'eval'                    => array('rgxp'=>'datim', 'datepicker'=>true, 'tl_class'=>'w50 wizard'),
141
+            'sql'                     => "varchar(10) NOT NULL default ''"
142
+        ),
143
+        'stop' => array
144
+        (
145
+            'exclude'                 => true,
146
+            'inputType'               => 'text',
147
+            'eval'                    => array('rgxp'=>'datim', 'datepicker'=>true, 'tl_class'=>'w50 wizard'),
148
+            'sql'                     => "varchar(10) NOT NULL default ''"
149
+        )
150
+    )
151
+);
0 152
new file mode 100644
... ...
@@ -0,0 +1,17 @@
1
+<?php
2
+
3
+declare(strict_types=1);
4
+
5
+/*
6
+ * This file is part of modal bundle for Contao.
7
+ *
8
+ * (c) Benjamin Roth
9
+ *
10
+ * @license LGPL-3.0-or-later
11
+ */
12
+
13
+use Contao\DC_Table;
14
+use Contao\DataContainer;
15
+
16
+$GLOBALS['TL_LANG']['MOD']['modals'][0] = 'PopUp-Fenster';
17
+$GLOBALS['TL_LANG']['MOD']['modals'][1] = 'Verwalten von Popup-Konfigurationen';
0 18
new file mode 100644
... ...
@@ -0,0 +1,16 @@
1
+<?php
2
+
3
+declare(strict_types=1);
4
+
5
+/*
6
+ * This file is part of modal bundle for Contao.
7
+ *
8
+ * (c) Benjamin Roth
9
+ *
10
+ * @license LGPL-3.0-or-later
11
+ */
12
+
13
+use Contao\DC_Table;
14
+use Contao\DataContainer;
15
+
16
+$GLOBALS['TL_LANG']['tl_vr_modal']['title'][0] = 'Titel';