Browse code

Revert "Debug"

This reverts commit 8e77a8b596446e14513ad2ffc4db90034b7ae73f.

Benjamin Roth authored on06/08/2024 11:39:14
Showing1 changed files
... ...
@@ -30,7 +30,7 @@ class LoadDataContainerListener
30 30
         {
31 31
             return;
32 32
         }
33
-dump('test');
33
+
34 34
         // Hook in the Formilicious fields
35 35
         if (is_array($GLOBALS['TL_DCA']['tl_form_field']['palettes']))
36 36
         {
Benjamin Roth authored on06/08/2024 11:36:56
Showing1 changed files
... ...
@@ -30,7 +30,7 @@ class LoadDataContainerListener
30 30
         {
31 31
             return;
32 32
         }
33
-
33
+dump('test');
34 34
         // Hook in the Formilicious fields
35 35
         if (is_array($GLOBALS['TL_DCA']['tl_form_field']['palettes']))
36 36
         {
Browse code

First iteration of revamped formilicious for Contao 4.13+

Benjamin Roth authored on20/01/2023 09:49:23
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,61 @@
1
+<?php
2
+
3
+declare(strict_types=1);
4
+
5
+/*
6
+ * This file is part of formilicious bundle for Contao.
7
+ *
8
+ * (c) Benjamin Roth
9
+ *
10
+ * @license LGPL-3.0-or-later
11
+ */
12
+
13
+namespace vonRotenberg\FormiliciousBundle\EventListener;
14
+
15
+use Contao\CoreBundle\DataContainer\PaletteManipulator;
16
+use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
17
+
18
+#[AsHook('loadDataContainer')]
19
+class LoadDataContainerListener
20
+{
21
+    /**
22
+     * Array containing all fields which shouldn't use Formilicous extensions
23
+     * @var array
24
+     */
25
+    protected $arrNoFl = array('__selector__','fieldsetStart','fieldsetStop','hidden','html','headline');
26
+
27
+    public function __invoke(string $table): void
28
+    {
29
+        if ($table != 'tl_form_field')
30
+        {
31
+            return;
32
+        }
33
+
34
+        // Hook in the Formilicious fields
35
+        if (is_array($GLOBALS['TL_DCA']['tl_form_field']['palettes']))
36
+        {
37
+            $palettes = array_diff(array_keys($GLOBALS['TL_DCA']['tl_form_field']['palettes']),$this->arrNoFl);
38
+
39
+            $PaletteManipulator = PaletteManipulator::create()
40
+                ->addLegend('formilicious_legend','expert_legend',PaletteManipulator::POSITION_BEFORE)
41
+                ->addField('eSM_fl_width','formilicious_legend',PaletteManipulator::POSITION_APPEND)
42
+                ->addField('eSM_fl_clear','formilicious_legend',PaletteManipulator::POSITION_APPEND)
43
+                ->addField('eSM_fl_class','formilicious_legend',PaletteManipulator::POSITION_APPEND)
44
+            ;
45
+
46
+            foreach ($palettes as $palette)
47
+            {
48
+                $pm = clone $PaletteManipulator;
49
+                if ($palette == 'submit')
50
+                {
51
+                    $pm
52
+                        ->addField('eSM_fl_lblpadding','formilicious_legend',PaletteManipulator::POSITION_APPEND)
53
+                        ->addField('eSM_fl_alignment','formilicious_legend',PaletteManipulator::POSITION_APPEND)
54
+                    ;
55
+                }
56
+                $pm->applyToPalette($palette,'tl_form_field');
57
+            }
58
+        }
59
+    }
60
+
61
+}