Browse code

Version 1.5 initial commit

Benjamin Roth authored on24/06/2024 12:06:17
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,39 @@
1
+<?php
2
+
3
+namespace Oveleon\ContaoMemberExtensionBundle\EventListener\DataContainer;
4
+
5
+use Contao\CoreBundle\DependencyInjection\Attribute\AsCallback;
6
+use Contao\CoreBundle\Security\ContaoCorePermissions;
7
+use Contao\DataContainer;
8
+use Contao\Input;
9
+use Contao\Message;
10
+use Contao\ModuleModel;
11
+use Contao\System;
12
+
13
+class ModuleFieldsListener
14
+{
15
+    #[AsCallback(table: 'tl_module', target: 'config.onload')]
16
+    public function showJsLibraryHint(DataContainer $dc): void
17
+    {
18
+        if ($_POST || Input::get('act') != 'edit')
19
+        {
20
+            return;
21
+        }
22
+
23
+        $security = System::getContainer()->get('security.helper');
24
+
25
+        if (
26
+            !$security->isGranted(ContaoCorePermissions::USER_CAN_ACCESS_MODULE, 'themes') ||
27
+            !$security->isGranted(ContaoCorePermissions::USER_CAN_ACCESS_LAYOUTS)
28
+        ) {
29
+            return;
30
+        }
31
+
32
+        $objModule = ModuleModel::findByPk($dc->id);
33
+
34
+        if (null !== $objModule && 'memberList' === $objModule->type && str_starts_with($objModule->customTpl, 'mod_memberList_table'))
35
+        {
36
+            Message::addInfo(sprintf(($GLOBALS['TL_LANG']['tl_module']['includeMemberListTable'] ?? null), 'memberExtension_list_row', 'j_datatables'));
37
+        }
38
+    }
39
+}