Browse code

Add enabled toggle to memberfiles configurations

Benjamin Roth authored on08/05/2025 10:56:36
Showing1 changed files
... ...
@@ -53,6 +53,11 @@ $GLOBALS['TL_DCA']['tl_memberfiles_config'] = [
53 53
                 'icon'       => 'delete.svg',
54 54
                 'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? null) . '\'))return false;Backend.getScrollOffset()"'
55 55
             ],
56
+            'toggle' => [
57
+                'href'       => 'act=toggle&field=enabled',
58
+                'icon'       => 'visible.svg',
59
+                'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"'
60
+            ],
56 61
             'show'   => [
57 62
                 'href' => 'act=show',
58 63
                 'icon' => 'show.svg'
... ...
@@ -61,7 +66,7 @@ $GLOBALS['TL_DCA']['tl_memberfiles_config'] = [
61 66
     ],
62 67
     'palettes' => [
63 68
         '__selector__' => ['hasNotification'],
64
-        'default' => '{title_legend},title;{config_legend},source,target,regexp,fields,hasNotification',
69
+        'default' => '{title_legend},title;{config_legend},source,target,regexp,fields,hasNotification;{enabled_legend},enabled}',
65 70
     ],
66 71
     'subpalettes' => [
67 72
         'hasNotification' => 'notification',
... ...
@@ -116,5 +121,13 @@ $GLOBALS['TL_DCA']['tl_memberfiles_config'] = [
116 121
             'eval'      => ['mandatory' => true, 'includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'],
117 122
             'sql'       => ['type' => 'integer', 'unsigned' => true, 'default' => 0]
118 123
         ],
124
+        'enabled' => [
125
+            'exclude'   => true,
126
+            'toggle'    => true,
127
+            'inputType' => 'checkbox',
128
+            'eval'      => ['tl_class' => 'w50'],
129
+            'sql'       => ['type' => 'string', 'length' => 1, 'fixed' => true, 'default' => '']
130
+        ],
131
+
119 132
     ]
120 133
 ];