@@ -135,65 +135,92 @@ public function get_field_types()
135
135
}
136
136
}
137
137
138
- if (!empty ($ this ->add_fields ))
139
- foreach ($ this ->add_fields as $ field_object )
140
- {
141
- $ field_name = isset ($ field_object ->field_name ) ? $ field_object ->field_name : $ field_object ;
138
+ if (!empty ($ this ->add_fields )) {
139
+ foreach ($ this ->add_fields as $ field_object ) {
140
+ $ field_name = isset ($ field_object ->field_name ) ? $ field_object ->field_name : $ field_object ;
142
141
143
- if (!isset ($ types [$ field_name ]))//Doesn't exist in the database? Create it for the CRUD
144
- {
145
- $ extras = false ;
146
- if ($ this ->change_field_type !== null && isset ($ this ->change_field_type [$ field_name ]))
147
- {
148
- $ field_type = $ this ->change_field_type [$ field_name ];
149
- $ extras = $ field_type ->extras ;
150
- }
142
+ if (!isset ($ types [$ field_name ]))//Doesn't exist in the database? Create it for the CRUD
143
+ {
144
+ $ extras = false ;
145
+ if ($ this ->change_field_type !== null && isset ($ this ->change_field_type [$ field_name ])) {
146
+ $ field_type = $ this ->change_field_type [$ field_name ];
147
+ $ extras = $ field_type ->extras ;
148
+ }
151
149
152
- $ field_info = (object )array (
153
- 'name ' => $ field_name ,
154
- 'crud_type ' => $ this ->change_field_type !== null && isset ($ this ->change_field_type [$ field_name ]) ?
155
- $ this ->change_field_type [$ field_name ]->type :
156
- 'string ' ,
157
- 'display_as ' => isset ($ this ->display_as [$ field_name ]) ?
158
- $ this ->display_as [$ field_name ] :
159
- ucfirst (str_replace ("_ " ," " ,$ field_name )),
160
- 'required ' => !empty ($ this ->required_fields ) && in_array ($ field_name ,$ this ->required_fields ) ? true : false ,
161
- 'extras ' => $ extras
162
- );
163
-
164
- $ types [$ field_name ] = $ field_info ;
165
- }
166
- }
150
+ $ field_info = (object )array (
151
+ 'name ' => $ field_name ,
152
+ 'crud_type ' => $ this ->change_field_type !== null && isset ($ this ->change_field_type [$ field_name ]) ?
153
+ $ this ->change_field_type [$ field_name ]->type :
154
+ 'string ' ,
155
+ 'display_as ' => isset ($ this ->display_as [$ field_name ]) ?
156
+ $ this ->display_as [$ field_name ] :
157
+ ucfirst (str_replace ("_ " , " " , $ field_name )),
158
+ 'required ' => !empty ($ this ->required_fields ) && in_array ($ field_name , $ this ->required_fields ) ? true : false ,
159
+ 'extras ' => $ extras
160
+ );
167
161
168
- if (! empty ( $ this -> edit_fields ))
169
- foreach ( $ this -> edit_fields as $ field_object )
170
- {
171
- $ field_name = isset ( $ field_object -> field_name ) ? $ field_object -> field_name : $ field_object ;
162
+ $ types [ $ field_name ] = $ field_info ;
163
+ }
164
+ }
165
+ }
172
166
173
- if (!isset ($ types [$ field_name ]))//Doesn't exist in the database? Create it for the CRUD
174
- {
175
- $ extras = false ;
176
- if ($ this ->change_field_type !== null && isset ($ this ->change_field_type [$ field_name ]))
177
- {
178
- $ field_type = $ this ->change_field_type [$ field_name ];
179
- $ extras = $ field_type ->extras ;
180
- }
167
+ if (!empty ($ this ->edit_fields )) {
168
+ foreach ($ this ->edit_fields as $ field_object ) {
169
+ $ field_name = isset ($ field_object ->field_name ) ? $ field_object ->field_name : $ field_object ;
181
170
182
- $ field_info = (object )array (
183
- 'name ' => $ field_name ,
184
- 'crud_type ' => $ this ->change_field_type !== null && isset ($ this ->change_field_type [$ field_name ]) ?
185
- $ this ->change_field_type [$ field_name ]->type :
186
- 'string ' ,
187
- 'display_as ' => isset ($ this ->display_as [$ field_name ]) ?
188
- $ this ->display_as [$ field_name ] :
189
- ucfirst (str_replace ("_ " ," " ,$ field_name )),
190
- 'required ' => in_array ($ field_name ,$ this ->required_fields ) ? true : false ,
191
- 'extras ' => $ extras
192
- );
193
-
194
- $ types [$ field_name ] = $ field_info ;
195
- }
196
- }
171
+ if (!isset ($ types [$ field_name ]))//Doesn't exist in the database? Create it for the CRUD
172
+ {
173
+ $ extras = false ;
174
+ if ($ this ->change_field_type !== null && isset ($ this ->change_field_type [$ field_name ])) {
175
+ $ field_type = $ this ->change_field_type [$ field_name ];
176
+ $ extras = $ field_type ->extras ;
177
+ }
178
+
179
+ $ field_info = (object )array (
180
+ 'name ' => $ field_name ,
181
+ 'crud_type ' => $ this ->change_field_type !== null && isset ($ this ->change_field_type [$ field_name ]) ?
182
+ $ this ->change_field_type [$ field_name ]->type :
183
+ 'string ' ,
184
+ 'display_as ' => isset ($ this ->display_as [$ field_name ]) ?
185
+ $ this ->display_as [$ field_name ] :
186
+ ucfirst (str_replace ("_ " , " " , $ field_name )),
187
+ 'required ' => in_array ($ field_name , $ this ->required_fields ) ? true : false ,
188
+ 'extras ' => $ extras
189
+ );
190
+
191
+ $ types [$ field_name ] = $ field_info ;
192
+ }
193
+ }
194
+ }
195
+
196
+ if (!empty ($ this ->read_fields )) {
197
+ foreach ($ this ->read_fields as $ field_object ) {
198
+ $ field_name = isset ($ field_object ->field_name ) ? $ field_object ->field_name : $ field_object ;
199
+
200
+ if (!isset ($ types [$ field_name ]))//Doesn't exist in the database? Create it for the CRUD
201
+ {
202
+ $ extras = false ;
203
+ if ($ this ->change_field_type !== null && isset ($ this ->change_field_type [$ field_name ])) {
204
+ $ field_type = $ this ->change_field_type [$ field_name ];
205
+ $ extras = $ field_type ->extras ;
206
+ }
207
+
208
+ $ field_info = (object )array (
209
+ 'name ' => $ field_name ,
210
+ 'crud_type ' => $ this ->change_field_type !== null && isset ($ this ->change_field_type [$ field_name ]) ?
211
+ $ this ->change_field_type [$ field_name ]->type :
212
+ 'string ' ,
213
+ 'display_as ' => isset ($ this ->display_as [$ field_name ]) ?
214
+ $ this ->display_as [$ field_name ] :
215
+ ucfirst (str_replace ("_ " , " " , $ field_name )),
216
+ 'required ' => !empty ($ this ->required_fields ) && in_array ($ field_name , $ this ->required_fields ) ? true : false ,
217
+ 'extras ' => $ extras
218
+ );
219
+
220
+ $ types [$ field_name ] = $ field_info ;
221
+ }
222
+ }
223
+ }
197
224
198
225
$ this ->field_types = $ types ;
199
226
@@ -4471,9 +4498,9 @@ protected function get_read_fields()
4471
4498
foreach ($ this ->read_fields as $ field_num => $ field )
4472
4499
{
4473
4500
if (isset ($ this ->display_as [$ field ]))
4474
- $ this ->read_fields [$ field_num ] = (object )array ('field_name ' => $ field , 'display_as ' => $ this ->display_as [$ field ]);
4501
+ $ this ->read_fields [$ field_num ] = (object )array ('field_name ' => $ field , 'display_as ' => $ this ->display_as [$ field ]);
4475
4502
else
4476
- $ this ->read_fields [$ field_num ] = (object )array ('field_name ' => $ field , 'display_as ' => $ field_types [$ field ]->display_as );
4503
+ $ this ->read_fields [$ field_num ] = (object )array ('field_name ' => $ field , 'display_as ' => $ field_types [$ field ]->display_as );
4477
4504
}
4478
4505
}
4479
4506
else
0 commit comments