Browse code

Use getAttributesFromDca hook instead of overwriting Contao core class

Benjamin Roth authored on07/10/2019 12:10:12
Showing1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,68 +0,0 @@
1
-<?php
2
-
3
-/**
4
- * eSales Media Formilicious for Contao Open Source CMS
5
- *
6
- * Copyright (C) 2013-2014 eSalesMedia
7
- *
8
- * @package    eSM_formilicious
9
- * @link       http://www.esales-media.de
10
- * @license    http://www.gnu.org/licenses/lgpl-3.0.html LGPL
11
- *
12
- * @author     Benjamin Roth <benjamin@esales-media.de>
13
- */
14
-
15
-namespace eSM_formilicious;
16
-
17
-abstract class Widget extends \Contao\Widget
18
-{
19
-
20
-  /**
21
-   * Extract the Widget attributes from a Data Container array
22
-   *
23
-   * @param array  $arrData  The field configuration array
24
-   * @param string $strName  The field name in the form
25
-   * @param mixed  $varValue The field value
26
-   * @param string $strField The field name in the database
27
-   * @param string $strTable The table name in the database
28
-   * @param object $objDca   An optional DataContainer object
29
-   *
30
-   * @return array An attributes array that can be passed to a widget
31
-   */
32
-  public static function getAttributesFromDca($arrData, $strName, $varValue=null, $strField='', $strTable='', $objDca=null)
33
-  {
34
-    $arrAttributes = parent::getAttributesFromDca($arrData, $strName, $varValue, $strField, $strTable, $objDca);
35
-
36
-    if (isset($arrData['eval']['eSM_fl_width']))
37
-    {
38
-      $arrAttributes['eSM_fl_width'] = $arrData['eval']['eSM_fl_width'];
39
-    }
40
-
41
-    if (isset($arrData['eval']['eSM_fl_clear']))
42
-    {
43
-      $arrAttributes['eSM_fl_clear'] = $arrData['eval']['eSM_fl_clear'];
44
-    }
45
-
46
-    if (isset($arrData['eval']['eSM_fl_class']))
47
-    {
48
-      $arrAttributes['eSM_fl_class'] = $arrData['eval']['eSM_fl_class'];
49
-    }
50
-
51
-    if (isset($arrData['eval']['eSM_fl_lblpadding']))
52
-    {
53
-      $arrAttributes['eSM_fl_lblpadding'] = $arrData['eval']['eSM_fl_lblpadding'];
54
-    }
55
-
56
-    if (isset($arrData['eval']['eSM_fl_alignment']))
57
-    {
58
-      $arrAttributes['eSM_fl_alignment'] = $arrData['eval']['eSM_fl_alignment'];
59
-    }
60
-
61
-    if (isset($arrData['eval']['eSM_fl_fieldClass']))
62
-    {
63
-      $arrAttributes['class'] = trim($arrAttributes['class'].' '.$arrData['eval']['eSM_fl_fieldClass']);
64
-    }
65
-
66
-    return $arrAttributes;
67
-  }
68
-}
69 0
\ No newline at end of file
Browse code

Add possibility to define an input field class in the DCA

(cherry picked from commit 95c9e6e)

Benjamin Roth authored on26/07/2017 11:00:31
Showing1 changed files
... ...
@@ -58,6 +58,11 @@ abstract class Widget extends \Contao\Widget
58 58
       $arrAttributes['eSM_fl_alignment'] = $arrData['eval']['eSM_fl_alignment'];
59 59
     }
60 60
 
61
+    if (isset($arrData['eval']['eSM_fl_fieldClass']))
62
+    {
63
+      $arrAttributes['class'] = trim($arrAttributes['class'].' '.$arrData['eval']['eSM_fl_fieldClass']);
64
+    }
65
+
61 66
     return $arrAttributes;
62 67
   }
63 68
 }
64 69
\ No newline at end of file
Browse code

Allow usage of Formilicous settings in DCA eval field settings for frontend purposes.

Benjamin Roth authored on29/08/2016 16:38:01
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,63 @@
1
+<?php
2
+
3
+/**
4
+ * eSales Media Formilicious for Contao Open Source CMS
5
+ *
6
+ * Copyright (C) 2013-2014 eSalesMedia
7
+ *
8
+ * @package    eSM_formilicious
9
+ * @link       http://www.esales-media.de
10
+ * @license    http://www.gnu.org/licenses/lgpl-3.0.html LGPL
11
+ *
12
+ * @author     Benjamin Roth <benjamin@esales-media.de>
13
+ */
14
+
15
+namespace eSM_formilicious;
16
+
17
+abstract class Widget extends \Contao\Widget
18
+{
19
+
20
+  /**
21
+   * Extract the Widget attributes from a Data Container array
22
+   *
23
+   * @param array  $arrData  The field configuration array
24
+   * @param string $strName  The field name in the form
25
+   * @param mixed  $varValue The field value
26
+   * @param string $strField The field name in the database
27
+   * @param string $strTable The table name in the database
28
+   * @param object $objDca   An optional DataContainer object
29
+   *
30
+   * @return array An attributes array that can be passed to a widget
31
+   */
32
+  public static function getAttributesFromDca($arrData, $strName, $varValue=null, $strField='', $strTable='', $objDca=null)
33
+  {
34
+    $arrAttributes = parent::getAttributesFromDca($arrData, $strName, $varValue, $strField, $strTable, $objDca);
35
+
36
+    if (isset($arrData['eval']['eSM_fl_width']))
37
+    {
38
+      $arrAttributes['eSM_fl_width'] = $arrData['eval']['eSM_fl_width'];
39
+    }
40
+
41
+    if (isset($arrData['eval']['eSM_fl_clear']))
42
+    {
43
+      $arrAttributes['eSM_fl_clear'] = $arrData['eval']['eSM_fl_clear'];
44
+    }
45
+
46
+    if (isset($arrData['eval']['eSM_fl_class']))
47
+    {
48
+      $arrAttributes['eSM_fl_class'] = $arrData['eval']['eSM_fl_class'];
49
+    }
50
+
51
+    if (isset($arrData['eval']['eSM_fl_lblpadding']))
52
+    {
53
+      $arrAttributes['eSM_fl_lblpadding'] = $arrData['eval']['eSM_fl_lblpadding'];
54
+    }
55
+
56
+    if (isset($arrData['eval']['eSM_fl_alignment']))
57
+    {
58
+      $arrAttributes['eSM_fl_alignment'] = $arrData['eval']['eSM_fl_alignment'];
59
+    }
60
+
61
+    return $arrAttributes;
62
+  }
63
+}
0 64
\ No newline at end of file