Browse code

Add translations and allow feGroup override in module

Benjamin Roth authored on08/02/2020 12:06:15
Showing4 changed files
... ...
@@ -81,7 +81,7 @@ class formilicious_tl_module extends \Backend
81 81
     $strName  = $arrField['name'];
82 82
 
83 83
     return sprintf(
84
-      '<input type="hidden" name="%s[%s][name]" id="ctrl_%s_row%s_name" value="%s"><div style="width:300px">%s' . ($GLOBALS['TL_DCA']['tl_member']['fields'][$strName]['eval']['mandatory'] ? '<span class="mandatory">*</span>' : '') . ' <span style="color:#b3b3b3; padding-left:3px;">[%s]</span></div>',
84
+      '<input type="hidden" name="%s[%s][name]" id="ctrl_%s_row%s_name" value="%s"><div style="width:175px">%s' . ($GLOBALS['TL_DCA']['tl_member']['fields'][$strName]['eval']['mandatory'] ? '<span class="mandatory">*</span>' : '') . ' <span style="color:#b3b3b3; padding-left:3px;">[%s]</span></div>',
85 85
       $objWidget->name,
86 86
       $i,
87 87
       $objWidget->name,
... ...
@@ -126,23 +126,30 @@ class formilicious_tl_module extends \Backend
126 126
         'input_field_callback' => array('formilicious_tl_module', 'onFieldnameInputFieldCallback'),
127 127
         'eval'                 => array('hideHead' => true, 'tl_class' => 'mcwUpdateFields'),
128 128
       ),
129
+      'feGroup' => array
130
+      (
131
+        'label'     => &$GLOBALS['TL_LANG']['tl_module']['editable_cols']['feGroup'],
132
+        'inputType' => 'select',
133
+        'options'   => array('personal', 'address', 'contact', 'login'),
134
+        'eval'      => array('style' => 'width:80px', 'includeBlankOption' => true, 'blankOptionLabel' => &$GLOBALS['TL_LANG']['MSC']['default']),
135
+      ),
129 136
       'mandatory' => array
130 137
       (
131
-        'label'     => &$GLOBALS['TL_LANG']['tl_module']['sr_co_addressFields']['mandatory'],
138
+        'label'     => &$GLOBALS['TL_LANG']['tl_module']['editable_cols']['mandatory'],
132 139
         'inputType' => 'select',
133 140
         'options'   => array('yes', 'no'),
134 141
         'reference' => &$GLOBALS['TL_LANG']['MSC'],
135
-        'eval'      => array('style' => 'width:80px', 'includeBlankOption' => true, 'blankOptionLabel' => &$GLOBALS['TL_LANG']['tl_iso_producttype']['attributes']['default']),
142
+        'eval'      => array('style' => 'width:80px', 'includeBlankOption' => true, 'blankOptionLabel' => &$GLOBALS['TL_LANG']['MSC']['default']),
136 143
       ),
137 144
       'eSM_fl_class'  => array
138 145
       (
139
-        'label'     => &$GLOBALS['TL_LANG']['tl_module']['sr_co_addressFields']['eSM_fl_class'],
146
+        'label'     => &$GLOBALS['TL_LANG']['tl_module']['editable_cols']['eSM_fl_class'],
140 147
         'inputType' => 'text',
141 148
         'eval'      => array('style' => 'width:80px'),
142 149
       ),
143 150
       'eSM_fl_width'  => array
144 151
       (
145
-        'label'     => &$GLOBALS['TL_LANG']['tl_module']['sr_co_addressFields']['eSM_fl_width'],
152
+        'label'     => &$GLOBALS['TL_LANG']['tl_module']['editable_cols']['eSM_fl_width'],
146 153
         'inputType' => 'select',
147 154
         'default'   => 100,
148 155
         'options'   => array(10, 11, 15, '16_5', 20, 22, 25, 30, 33, 35, 40, 44, 45, 50, 55, 60, 65, 66, 70, 75, 80, 85, 90, 95, 100),
... ...
@@ -150,7 +157,7 @@ class formilicious_tl_module extends \Backend
150 157
       ),
151 158
       'eSM_fl_clear'   => array
152 159
       (
153
-        'label'     => &$GLOBALS['TL_LANG']['tl_module']['sr_co_addressFields']['eSM_fl_clear'],
160
+        'label'     => &$GLOBALS['TL_LANG']['tl_module']['editable_cols']['eSM_fl_clear'],
154 161
         'inputType' => 'checkbox',
155 162
       ),
156 163
     );
157 164
new file mode 100644
... ...
@@ -0,0 +1,24 @@
1
+<?php 
2
+
3
+/**
4
+ * Contao Open Source CMS
5
+ * 
6
+ * Copyright (C) 2005-2012 Leo Feyer
7
+ * 
8
+ * @package   eSM_reisen 
9
+ * @author    Benjamin Roth <benjamin@esales-media.de> 
10
+ * @license   commercial 
11
+ * @copyright eSales Media 2012 
12
+ */
13
+
14
+
15
+/**
16
+ * Fields
17
+ */
18
+$GLOBALS['TL_LANG']['tl_module']['editable_cols'] = [
19
+  'feGroup'      => ['Gruppe',''],
20
+  'mandatory'    => ['Pflichtfeld',''],
21
+  'eSM_fl_class' => ['Feldbreite',''],
22
+  'eSM_fl_width' => ['Css-Klasse',''],
23
+  'eSM_fl_clear' => ['Neue Zeile',''],
24
+];
... ...
@@ -58,7 +58,7 @@ class ModulePersonalData extends \Contao\ModulePersonalData
58 58
     foreach ($this->editable as $key=>$fielddata)
59 59
     {
60 60
       // Split formilicious editable data in single vars
61
-      list($active, $field, $fieldMandatory, $fieldClass, $fieldWidth, $fieldClr, $position) = array_values($fielddata);
61
+      list($active, $field, $fieldGroup, $fieldMandatory, $fieldClass, $fieldWidth, $fieldClr, $position) = array_values($fielddata);
62 62
 
63 63
       if (!$active)
64 64
       {
... ...
@@ -72,6 +72,10 @@ class ModulePersonalData extends \Contao\ModulePersonalData
72 72
       {
73 73
         $GLOBALS['TL_DCA']['tl_member']['fields'][$field]['eval']['mandatory'] = $fieldMandatory == 'yes' ? true : false;
74 74
       }
75
+      if ($fieldGroup)
76
+      {
77
+        $GLOBALS['TL_DCA']['tl_member']['fields'][$field]['eval']['feGroup'] = $fieldGroup;
78
+      }
75 79
       $arrEditable[$key] = $field;
76 80
     }
77 81
     $this->editable = $arrEditable;
... ...
@@ -58,7 +58,7 @@ class ModuleRegistration extends \Contao\ModuleRegistration
58 58
     foreach ($this->editable as $key=>$fielddata)
59 59
     {
60 60
       // Split formilicious editable data in single vars
61
-      list($active, $field, $fieldMandatory, $fieldClass, $fieldWidth, $fieldClr, $position) = array_values($fielddata);
61
+      list($active, $field, $fieldGroup, $fieldMandatory, $fieldClass, $fieldWidth, $fieldClr, $position) = array_values($fielddata);
62 62
 
63 63
       if (!$active)
64 64
       {
... ...
@@ -72,6 +72,10 @@ class ModuleRegistration extends \Contao\ModuleRegistration
72 72
       {
73 73
         $GLOBALS['TL_DCA']['tl_member']['fields'][$field]['eval']['mandatory'] = $fieldMandatory == 'yes' ? true : false;
74 74
       }
75
+      if ($fieldGroup)
76
+      {
77
+        $GLOBALS['TL_DCA']['tl_member']['fields'][$field]['eval']['feGroup'] = $fieldGroup;
78
+      }
75 79
       $arrEditable[$key] = $field;
76 80
     }
77 81
     $this->editable = $arrEditable;