Browse code

Change directory structure of bundle and add first draft of fragment controller module

Benjamin Roth authored on10/01/2023 14:11:33
Showing15 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,3 @@
1
+services:
2
+    _defaults:
3
+        autoconfigure: true
0 4
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,15 @@
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 vonRotenberg\ModalBundle\Controller\FrontendModule\ModalModuleController;
14
+
15
+$GLOBALS['TL_DCA']['tl_module']['palettes'][ModalModuleController::TYPE] = '{title_legend},name,type;{redirect_legend},jumpTo';
0 16
new file mode 100644
... ...
@@ -0,0 +1,170 @@
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('title ASC'),
39
+            'panelLayout'             => 'filter;sort,search,limit',
40
+        ),
41
+        'label' => array
42
+        (
43
+            'fields' => array('title','delay'),
44
+            'showColumns' => true,
45
+            'format' => '%s',
46
+        ),
47
+        'global_operations' => array
48
+        (
49
+            'all' => array
50
+            (
51
+                'href'                => 'act=select',
52
+                'class'               => 'header_edit_all',
53
+                'attributes'          => 'onclick="Backend.getScrollOffset()" accesskey="e"'
54
+            )
55
+        ),
56
+        'operations' => array
57
+        (
58
+            'edit' => array
59
+            (
60
+                'href'                => 'table=tl_content',
61
+                'icon'                => 'edit.svg'
62
+            ),
63
+            'editheader' => array
64
+            (
65
+                'href'                => 'act=edit',
66
+                'icon'                => 'header.svg'
67
+            ),
68
+            'copy' => array
69
+            (
70
+                'href'                => 'act=copy',
71
+                'icon'                => 'copy.svg'
72
+            ),
73
+            'delete' => array
74
+            (
75
+                'href'                => 'act=delete',
76
+                'icon'                => 'delete.svg',
77
+                'attributes'          => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? null) . '\'))return false;Backend.getScrollOffset()"'
78
+            ),
79
+            'toggle' => array
80
+            (
81
+                'href'                => 'act=toggle&amp;field=published',
82
+                'icon'                => 'visible.svg',
83
+                'showInHeader'        => true
84
+            ),
85
+            'show' => array
86
+            (
87
+                'href'                => 'act=show',
88
+                'icon'                => 'show.svg'
89
+            )
90
+        )
91
+    ),
92
+    'palettes' => array
93
+    (
94
+        '__selector__'                => array(''),
95
+        'default'                     => '{title_legend},title;{config_legend},modal_title,delay;{publish_legend},published,start,stop'
96
+    ),
97
+    'subpalettes' => array
98
+    (
99
+
100
+    ),
101
+    'fields' => array
102
+    (
103
+        'id' => array
104
+        (
105
+            'sql'                     => "int(10) unsigned NOT NULL auto_increment"
106
+        ),
107
+        'pid' => array
108
+        (
109
+            'foreignKey'              => 'tl_news_archive.title',
110
+            'sql'                     => "int(10) unsigned NOT NULL default 0",
111
+            'relation'                => array('type'=>'belongsTo', 'load'=>'lazy')
112
+        ),
113
+        'tstamp' => array
114
+        (
115
+            'sorting'                 => true,
116
+            'flag'                    => DataContainer::SORT_DAY_DESC,
117
+            'sql'                     => "int(10) unsigned NOT NULL default 0"
118
+        ),
119
+        'title' => array
120
+        (
121
+            'exclude'                 => true,
122
+            'search'                  => true,
123
+            'sorting'                 => true,
124
+            'flag'                    => DataContainer::SORT_INITIAL_LETTER_ASC,
125
+            'inputType'               => 'text',
126
+            'eval'                    => array('mandatory'=>true, 'maxlength'=>255, 'tl_class'=>'w50'),
127
+            'sql'                     => "varchar(255) NOT NULL default ''"
128
+        ),
129
+        'modal_title' => array
130
+        (
131
+            'exclude'                 => true,
132
+            'inputType'               => 'text',
133
+            'eval'                    => array('maxlength'=>255, 'tl_class'=>'w50'),
134
+            'sql'                     => "varchar(255) NOT NULL default ''"
135
+        ),
136
+        'delay' => array
137
+        (
138
+            'exclude'                 => true,
139
+            'sorting'                 => true,
140
+            'flag'                    => DataContainer::SORT_ASC,
141
+            'inputType'               => 'text',
142
+            'eval'                    => array('mandatory'=>true, 'rgxp'=>'natural','maxlength'=>5, 'maxval'=>65535, 'tl_class'=>'w50'),
143
+            'sql'                     => "smallint(5) unsigned NOT NULL default 0"
144
+        ),
145
+        'published' => array
146
+        (
147
+            'exclude'                 => true,
148
+            'toggle'                  => true,
149
+            'filter'                  => true,
150
+            'flag'                    => DataContainer::SORT_INITIAL_LETTER_ASC,
151
+            'inputType'               => 'checkbox',
152
+            'eval'                    => array('doNotCopy'=>true),
153
+            'sql'                     => "char(1) NOT NULL default ''"
154
+        ),
155
+        'start' => array
156
+        (
157
+            'exclude'                 => true,
158
+            'inputType'               => 'text',
159
+            'eval'                    => array('rgxp'=>'datim', 'datepicker'=>true, 'tl_class'=>'w50 wizard'),
160
+            'sql'                     => "varchar(10) NOT NULL default ''"
161
+        ),
162
+        'stop' => array
163
+        (
164
+            'exclude'                 => true,
165
+            'inputType'               => 'text',
166
+            'eval'                    => array('rgxp'=>'datim', 'datepicker'=>true, 'tl_class'=>'w50 wizard'),
167
+            'sql'                     => "varchar(10) NOT NULL default ''"
168
+        )
169
+    )
170
+);
0 171
new file mode 100644
... ...
@@ -0,0 +1,18 @@
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 vonRotenberg\ModalBundle\Controller\FrontendModule\ModalModuleController;
14
+
15
+$GLOBALS['TL_LANG']['MOD']['modals'][0] = 'PopUp-Fenster';
16
+$GLOBALS['TL_LANG']['MOD']['modals'][1] = 'Verwalten von Popup-Konfigurationen';
17
+$GLOBALS['TL_LANG']['FMD'][ModalModuleController::TYPE][0] = 'Pop-Up';
18
+$GLOBALS['TL_LANG']['FMD'][ModalModuleController::TYPE][1] = 'Gibt eine Pop-Up Konfiguration aus.';
0 19
new file mode 100644
... ...
@@ -0,0 +1,23 @@
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] = 'Bezeichnung';
17
+$GLOBALS['TL_LANG']['tl_vr_modal']['title'][1] = 'Die interne Bezeichnung des Pop-Ups.';
18
+$GLOBALS['TL_LANG']['tl_vr_modal']['tstamp'][0] = 'Änderungsdatum';
19
+$GLOBALS['TL_LANG']['tl_vr_modal']['tstamp'][1] = 'Zeitpunkt der letzten Änderung.';
20
+$GLOBALS['TL_LANG']['tl_vr_modal']['modal_title'][0] = 'Titel des Pop-Ups';
21
+$GLOBALS['TL_LANG']['tl_vr_modal']['modal_title'][1] = 'Der Titel der als Leiste über dem Pop-Up angezeigt wird.';
22
+$GLOBALS['TL_LANG']['tl_vr_modal']['delay'][0] = 'Anzeigeverzögerung';
23
+$GLOBALS['TL_LANG']['tl_vr_modal']['delay'][1] = 'Die Zeit, bis das Pop-Up nach dem vollständigen Laden der Seite geöffnet wird.';
0 24
new file mode 100644
1 25
new file mode 100644
... ...
@@ -0,0 +1,34 @@
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
+namespace vonRotenberg\ModalBundle\Controller\FrontendModule;
14
+
15
+use Contao\CoreBundle\Controller\FrontendModule\AbstractFrontendModuleController;
16
+use Contao\CoreBundle\ServiceAnnotation\FrontendModule;
17
+use Contao\ModuleModel;
18
+use Contao\Template;
19
+use Symfony\Component\HttpFoundation\Request;
20
+use Symfony\Component\HttpFoundation\Response;
21
+
22
+/**
23
+ * @FrontendModule(ModalModuleController::TYPE, category="miscellaneous")
24
+ */
25
+class ModalModuleController extends AbstractFrontendModuleController
26
+{
27
+    public const TYPE = 'modal_module';
28
+
29
+    protected function getResponse(Template $template, ModuleModel $model, Request $request): ?Response
30
+    {
31
+        return $template->getResponse();
32
+    }
33
+
34
+}
... ...
@@ -21,7 +21,7 @@ class VonrotenbergModalExtension extends Extension
21 21
 {
22 22
     public function load(array $configs, ContainerBuilder $container): void
23 23
     {
24
-        $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
24
+        $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../../config'));
25 25
         $loader->load('services.yml');
26 26
     }
27 27
 }
28 28
deleted file mode 100644
... ...
@@ -1,3 +0,0 @@
1
-services:
2
-    _defaults:
3
-        autoconfigure: true
4 0
deleted file mode 100644
... ...
@@ -1,17 +0,0 @@
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
-);
18 0
deleted file mode 100644
... ...
@@ -1,151 +0,0 @@
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
-);
152 0
deleted file mode 100644
... ...
@@ -1,17 +0,0 @@
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';
18 0
deleted file mode 100644
... ...
@@ -1,16 +0,0 @@
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';
... ...
@@ -16,4 +16,8 @@ use Symfony\Component\HttpKernel\Bundle\Bundle;
16 16
 
17 17
 class VonrotenbergModalBundle extends Bundle
18 18
 {
19
+    public function getPath(): string
20
+    {
21
+        return \dirname(__DIR__);
22
+    }
19 23
 }