1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
|
4
|
|
|
namespace SunnySideUp\BuildDataObject; |
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
8
|
|
|
abstract class BuildController extends \Controller { |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
private static $form_data_session_variable = 'SunnySideUp\BuildDataObject\DataObjectBuildController'; |
|
|
|
|
12
|
|
|
|
13
|
|
|
private static $url_segment = 'build'; |
|
|
|
|
14
|
|
|
|
15
|
|
|
private static $allowed_actions = [ |
|
|
|
|
16
|
|
|
'primaryformstart' => true, |
17
|
|
|
'PrimaryForm' => true, |
18
|
|
|
'doprimaryform' => true, |
19
|
|
|
'secondaryformstart' => true, |
20
|
|
|
'SecondaryForm' => true, |
21
|
|
|
'dosecondaryform' => true, |
22
|
|
|
'results' => true, |
23
|
|
|
'startover' => true, |
24
|
|
|
'debug' => true |
25
|
|
|
]; |
26
|
|
|
|
27
|
|
|
protected $myBaseClass = 'DataObject'; |
28
|
|
|
|
29
|
|
|
protected $apiProvider = 'SunnySideUp\BuildDataObject\API'; |
30
|
|
|
|
31
|
|
|
abstract protected function primaryThingsToBuild(); |
|
|
|
|
32
|
|
|
|
33
|
|
|
abstract protected function secondaryThingsToBuild(); |
|
|
|
|
34
|
|
|
|
35
|
|
|
public function Link($action = null) |
36
|
|
|
{ |
37
|
|
|
if($action) { |
38
|
|
|
$action .= '/'; |
39
|
|
|
} |
40
|
|
|
return |
41
|
|
|
'/'.$this->Config()->get('url_segment'). |
42
|
|
|
'/'.strtolower($this->myBaseClass). |
43
|
|
|
'/'.$action; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function Title() |
47
|
|
|
{ |
48
|
|
|
return 'Build a '.$this->myBaseClass.' - Step '.$this->step.' of 2'; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
|
52
|
|
|
public function jQueryLink() |
53
|
|
|
{ |
54
|
|
|
return \Director::absoluteURL('/framework/thirdparty/jquery/jquery.js'); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function startover() |
58
|
|
|
{ |
59
|
|
|
$this->saveData('_PrimaryForm', null); |
60
|
|
|
$this->saveData('_SecondaryForm', null); |
61
|
|
|
return $this->redirect($this->link('primaryformstart')); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* |
66
|
|
|
* @var Form |
67
|
|
|
*/ |
68
|
|
|
protected $step = 1; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* |
72
|
|
|
* @var Form |
73
|
|
|
*/ |
74
|
|
|
protected $form = null; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* |
78
|
|
|
* @var Form |
79
|
|
|
*/ |
80
|
|
|
protected $prevLink = null; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* |
84
|
|
|
* @var ArrayList |
85
|
|
|
*/ |
86
|
|
|
protected $finalData = null; |
87
|
|
|
|
88
|
|
|
function index() |
|
|
|
|
89
|
|
|
{ |
90
|
|
|
return $this->redirect($this->Link('primaryformstart')); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
function primaryformstart() |
|
|
|
|
94
|
|
|
{ |
95
|
|
|
$this->PrimaryForm(); |
96
|
|
|
$this->prevLink = $this->Link('startover'); |
|
|
|
|
97
|
|
|
|
98
|
|
|
return $this->renderWith('BuildControllerForm'); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
function PrimaryForm() |
|
|
|
|
102
|
|
|
{ |
103
|
|
|
$this->form = $this->createForm('PrimaryForm', 'Build Model'); |
|
|
|
|
104
|
|
|
|
105
|
|
|
return $this->form; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
function doprimaryform($data, $form) |
|
|
|
|
109
|
|
|
{ |
110
|
|
|
$this->saveData('_PrimaryForm', $data); |
111
|
|
|
|
112
|
|
|
return $this->redirect($this->Link('secondaryformstart')); |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
|
116
|
|
|
function secondaryformstart() |
|
|
|
|
117
|
|
|
{ |
118
|
|
|
$this->step = 2; |
|
|
|
|
119
|
|
|
$this->SecondaryForm(); |
120
|
|
|
$this->prevLink = $this->Link('primaryformstart'); |
|
|
|
|
121
|
|
|
|
122
|
|
|
return $this->renderWith('BuildControllerForm'); |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
function SecondaryForm() |
|
|
|
|
126
|
|
|
{ |
127
|
|
|
$this->form = $this->createForm('SecondaryForm', 'Download Example Class'); |
|
|
|
|
128
|
|
|
|
129
|
|
|
return $this->form; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
|
133
|
|
|
function dosecondaryform($data, $form) |
|
|
|
|
134
|
|
|
{ |
135
|
|
|
$this->saveData('_SecondaryForm', $data); |
136
|
|
|
|
137
|
|
|
return $this->redirect($this->Link('results')); |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
function results() |
|
|
|
|
141
|
|
|
{ |
142
|
|
|
$this->finalData = $this->processedFormData($this->retrieveData()); |
143
|
|
|
return \SS_HTTPRequest::send_file( |
144
|
|
|
$this->renderWith($this->resultsTemplateForBuilder()), |
145
|
|
|
$this->finalData->Name.'.php' |
146
|
|
|
); |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
function debug() |
|
|
|
|
150
|
|
|
{ |
151
|
|
|
$this->finalData = $this->processedFormData($this->retrieveData()); |
152
|
|
|
print_r($this->CanMethodBuilder('canEdit')); |
|
|
|
|
153
|
|
|
print_r($this->finalData); |
154
|
|
|
die('-----------------------------'); |
|
|
|
|
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
function Form() |
|
|
|
|
158
|
|
|
{ |
159
|
|
|
return $this->form; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
function FinalData() |
|
|
|
|
163
|
|
|
{ |
164
|
|
|
return $this->finalData; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
function PrevLink() |
|
|
|
|
168
|
|
|
{ |
169
|
|
|
return $this->prevLink; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
function MyCanMethodBuilder($type, $value) { |
|
|
|
|
173
|
|
|
if($value === 'parent') { |
174
|
|
|
return null; |
175
|
|
|
} elseif($value === 'one') { |
176
|
|
|
$str = 'self::get()->count() ? false : true;'; |
177
|
|
|
} elseif($value === 'true') { |
178
|
|
|
$str = 'true;'; |
179
|
|
|
} elseif($value === 'false') { |
180
|
|
|
$str = 'false;'; |
181
|
|
|
} else { |
182
|
|
|
$str = 'Permission::check(\''.$value.'\', \'any\', $member);'; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
return \DBField::create_field('Varchar', $str); |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
|
189
|
|
|
protected function createForm($formName, $actionTitle) |
190
|
|
|
{ |
191
|
|
|
if($formName === 'PrimaryForm') { |
192
|
|
|
$isPrimary = true; |
193
|
|
|
$isSecond = false; |
|
|
|
|
194
|
|
|
} elseif($formName === 'SecondaryForm') { |
195
|
|
|
$isPrimary = false; |
196
|
|
|
$isSecond = true; |
|
|
|
|
197
|
|
|
} else { |
198
|
|
|
user_error('Set right form type: '.$formName.' is not valid'); |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
$finalFields = \FieldList::create(); |
202
|
|
|
|
203
|
|
|
if($isPrimary) { |
|
|
|
|
204
|
|
|
$toBuild = $this->primaryThingsToBuild(); |
205
|
|
|
$finalFields->push(\HeaderField::create('Name your '.$this->myBaseClass)); |
206
|
|
|
$finalFields->push(\TextField::create('Name', '')); |
207
|
|
|
$finalFields->push(\HeaderField::create('Extends')); |
208
|
|
|
$possibleExtensions = $this->myAPI()->PossibleRelationsWithBaseClass($this->myBaseClass); |
209
|
|
|
asort($possibleExtensions); |
210
|
|
|
$finalFields->push( |
211
|
|
|
\DropdownField::create( |
212
|
|
|
'Extends', |
213
|
|
|
'', |
214
|
|
|
$possibleExtensions |
215
|
|
|
) |
216
|
|
|
); |
217
|
|
|
$additionalFields = $this->additionalPrimaryFields(); |
218
|
|
|
foreach($additionalFields as $additionalField) { |
219
|
|
|
$finalFields->push($additionalField); |
220
|
|
|
} |
221
|
|
|
} else { |
222
|
|
|
$toBuild = $this->secondaryThingsToBuild(); |
223
|
|
|
} |
224
|
|
|
$formFields = []; |
225
|
|
|
$formFieldsWithMultiple = []; |
226
|
|
|
|
227
|
|
|
$count = 0; |
228
|
|
|
//build fields ... |
229
|
|
|
foreach($toBuild as $item) { |
230
|
|
|
$name = $item[0]; |
231
|
|
|
$sourceMethod1 = $item[1]; |
232
|
|
|
$sourceMethod2 = $item[2]; |
233
|
|
|
$isMultiple = $item[3]; |
234
|
|
|
|
235
|
|
|
|
236
|
|
|
//work out style |
237
|
|
|
$hasKeyAndValue = false; |
238
|
|
|
if($sourceMethod1 && $sourceMethod2) { |
239
|
|
|
$hasKeyAndValue = true; |
240
|
|
|
} |
241
|
|
|
$formFields[$count] = []; |
242
|
|
|
if($isMultiple) { |
243
|
|
|
$max = 12; |
244
|
|
|
} else { |
245
|
|
|
$max = 1; |
246
|
|
|
} |
247
|
|
|
$formFields[$count][0] = [ |
248
|
|
|
$name.'_HEADER', |
249
|
|
|
'HeaderField', |
250
|
|
|
$name |
251
|
|
|
]; |
252
|
|
|
|
253
|
|
|
|
254
|
|
|
//work out sources |
255
|
|
|
if($sourceMethod1 && $this->myAPI()->hasMethod($sourceMethod1)) { |
256
|
|
|
$source1 = $this->myAPI()->$sourceMethod1(); |
257
|
|
|
} else { |
258
|
|
|
$source1 = null; |
259
|
|
|
} |
260
|
|
|
if($sourceMethod2 && $this->myAPI()->hasMethod($sourceMethod2)) { |
261
|
|
|
$source2 = $this->myAPI()->$sourceMethod2(); |
262
|
|
|
} elseif($sourceMethod2) { |
263
|
|
|
$source2 = null; |
264
|
|
|
} else { |
265
|
|
|
$source2 = 'ignore'; |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
//work out field names |
269
|
|
|
|
270
|
|
|
for($i = 1; $i <= $max; $i++) { |
271
|
|
|
if($hasKeyAndValue) { |
272
|
|
|
if($isMultiple) { |
273
|
|
|
$nameKey = $name.'__KEY__'.$i; |
274
|
|
|
$nameValue = $name.'__VALUE__'.$i; |
275
|
|
|
$formFieldsWithMultiple[$nameKey] = $nameKey; |
276
|
|
|
} else { |
277
|
|
|
$nameKey = $name.'__KEY__'; |
278
|
|
|
$nameValue = $name.'__VALUE__'; |
279
|
|
|
} |
280
|
|
|
} else { |
281
|
|
|
if($isMultiple) { |
282
|
|
|
$nameKey = $name.$i; |
283
|
|
|
$nameValue = ''; |
284
|
|
|
$formFieldsWithMultiple[$nameKey] = $nameKey; |
285
|
|
|
} else { |
286
|
|
|
$nameKey = $name; |
287
|
|
|
$nameValue = ''; |
288
|
|
|
} |
289
|
|
|
} |
290
|
|
|
if($hasKeyAndValue) { |
291
|
|
|
//key field |
292
|
|
View Code Duplication |
if($source1) { |
|
|
|
|
293
|
|
|
$formFields[$count][$i]['KEY'] = [ |
294
|
|
|
$nameKey, |
295
|
|
|
'DropdownField', |
296
|
|
|
$source1 |
297
|
|
|
]; |
298
|
|
|
} else { |
299
|
|
|
$formFields[$count][$i]['KEY'] = [ |
300
|
|
|
$nameKey, |
301
|
|
|
'TextField' |
302
|
|
|
]; |
303
|
|
|
} |
304
|
|
|
|
305
|
|
|
//value field |
306
|
|
View Code Duplication |
if($source2) { |
|
|
|
|
307
|
|
|
$formFields[$count][$i]['VALUE'] = [ |
308
|
|
|
$nameValue, |
309
|
|
|
'DropdownField', |
310
|
|
|
$source2 |
311
|
|
|
]; |
312
|
|
|
} else { |
313
|
|
|
$formFields[$count][$i]['VALUE'] = [ |
314
|
|
|
$nameValue, |
315
|
|
|
'TextField' |
316
|
|
|
]; |
317
|
|
|
} |
318
|
|
View Code Duplication |
} else { |
|
|
|
|
319
|
|
|
//keys only! |
320
|
|
|
if($source1) { |
321
|
|
|
$formFields[$count][$i] = [ |
322
|
|
|
$nameKey, |
323
|
|
|
'DropdownField', |
324
|
|
|
$source1 |
325
|
|
|
]; |
326
|
|
|
} else { |
327
|
|
|
$formFields[$count][$i] = [ |
328
|
|
|
$nameKey, |
329
|
|
|
'TextField' |
330
|
|
|
]; |
331
|
|
|
} |
332
|
|
|
} |
333
|
|
|
} |
334
|
|
|
if($i > 2) { |
335
|
|
|
$formFields[$count][$i + 1] = [ |
336
|
|
|
$name.'_ADD_'.$i, |
337
|
|
|
'LiteralField', |
338
|
|
|
' |
339
|
|
|
<div class="CompositeField add-and-remove"> |
340
|
|
|
<a href="#" class="add first-add"><i class="material-icons">add_circle_outline</i></a> |
341
|
|
|
<a href="#" class="remove"><i class="material-icons">remove_circle_outline</i></a> |
342
|
|
|
</div> |
343
|
|
|
' |
344
|
|
|
]; |
345
|
|
|
} |
346
|
|
|
$count++; |
347
|
|
|
} |
348
|
|
|
//create fields ... |
349
|
|
|
$count = 0; |
350
|
|
|
foreach($formFields as $outerCount => $subFieldList) { |
351
|
|
|
$count++; |
352
|
|
|
$compositeField = \CompositeField::create(); |
353
|
|
|
$compositeField->addExtraClass('OuterComposite pos'.$count); |
354
|
|
|
$innerCount = 0; |
355
|
|
|
foreach($subFieldList as $innerCount => $fieldDetails) { |
356
|
|
|
$innerCount++; |
357
|
|
|
if(isset($fieldDetails['KEY']) && isset($fieldDetails['VALUE'])) { |
358
|
|
|
$subCompositeField = \CompositeField::create(); |
359
|
|
|
$subCompositeField->addExtraClass('InnerComposite pos'.$innerCount); |
360
|
|
|
foreach($fieldDetails as $fieldDetailsInner) { |
361
|
|
|
$fieldName = $fieldDetailsInner[0]; |
362
|
|
|
$fieldType = $fieldDetailsInner[1]; |
363
|
|
|
$additionalClasses = []; |
364
|
|
|
if(strpos($fieldName, '__KEY__')) { |
365
|
|
|
$additionalClasses[] = 'mykey'; |
366
|
|
|
} |
367
|
|
|
if(strpos($fieldName, '__VALUE__')) { |
368
|
|
|
$additionalClasses[] = 'myvalue'; |
369
|
|
|
} |
370
|
|
|
if(isset($fieldDetailsInner[2])) { |
371
|
|
|
$source = $fieldDetailsInner[2]; |
372
|
|
|
asort($source); |
373
|
|
|
$source = $this->prependNullOption( $source ); |
374
|
|
|
$tempField = $fieldType::create($fieldName, '', $source); |
375
|
|
|
} else { |
376
|
|
|
$tempField = $fieldType::create($fieldName, ''); |
377
|
|
|
} |
378
|
|
|
if(count($additionalClasses)) { |
379
|
|
|
$classes = implode(' ', $additionalClasses); |
380
|
|
|
$tempField->addExtraClass($classes); |
381
|
|
|
} |
382
|
|
|
$subCompositeField->push($tempField); |
383
|
|
|
} |
384
|
|
|
$compositeField->push($subCompositeField); |
385
|
|
|
} else { |
386
|
|
|
$fieldName = $fieldDetails[0]; |
387
|
|
|
if(isset($formFieldsWithMultiple[$fieldName])) { |
388
|
|
|
$subCompositeField = \CompositeField::create(); |
389
|
|
|
$subCompositeField->addExtraClass('InnerComposite pos'.$innerCount); |
390
|
|
|
} else { |
391
|
|
|
$subCompositeField = null; |
392
|
|
|
} |
393
|
|
|
$fieldType = $fieldDetails[1]; |
394
|
|
|
if($fieldType === 'DropdownField') { |
395
|
|
|
$source = $fieldDetails[2]; |
396
|
|
|
asort($source); |
397
|
|
|
$source = $this->prependNullOption($source); |
398
|
|
|
$myTempfield = $fieldType::create($fieldName, '', $source); |
399
|
|
|
} elseif($fieldType === 'HeaderField') { |
400
|
|
|
$title = str_replace('_', ' ', $fieldDetails[2]); |
401
|
|
|
$myTempfield = $fieldType::create($fieldName, $title); |
402
|
|
|
} elseif($fieldType === 'LiteralField') { |
403
|
|
|
$title = $fieldDetails[2]; |
404
|
|
|
$myTempfield = $fieldType::create($fieldName, $title); |
405
|
|
|
} else { |
406
|
|
|
$myTempfield = $fieldType::create($fieldName, ''); |
407
|
|
|
} |
408
|
|
|
if($subCompositeField) { |
409
|
|
|
$subCompositeField->push($myTempfield); |
410
|
|
|
$compositeField->push($subCompositeField); |
411
|
|
|
} else { |
412
|
|
|
$compositeField->push($myTempfield); |
413
|
|
|
} |
414
|
|
|
} |
415
|
|
|
} |
416
|
|
|
$finalFields->push($compositeField); |
417
|
|
|
} |
418
|
|
|
$actions = \FieldList::create( |
419
|
|
|
[\FormAction::create('do'.strtolower($formName), $actionTitle)] |
420
|
|
|
); |
421
|
|
|
|
422
|
|
|
$form = \Form::create($this, $formName, $finalFields, $actions); |
423
|
|
|
$form->setFormAction($this->Link($formName)); |
424
|
|
|
$form->loadDataFrom($this->retrieveData()); |
425
|
|
|
|
426
|
|
|
return $form; |
427
|
|
|
} |
428
|
|
|
|
429
|
|
|
/** |
430
|
|
|
* returns an array of fields |
431
|
|
|
* @return array |
432
|
|
|
*/ |
433
|
|
|
protected function additionalPrimaryFields() |
434
|
|
|
{ |
435
|
|
|
return []; |
436
|
|
|
} |
437
|
|
|
|
438
|
|
|
protected function saveData($name, $data) |
439
|
|
|
{ |
440
|
|
|
$var = $this->Config()->get('form_data_session_variable'); |
441
|
|
|
\Session::set($var.$name, $data); |
442
|
|
|
\Session::save(); |
443
|
|
|
} |
444
|
|
|
|
445
|
|
|
private $_data = null; |
446
|
|
|
|
447
|
|
|
protected function retrieveData() |
|
|
|
|
448
|
|
|
{ |
449
|
|
|
if(! $this->_data) { |
450
|
|
|
$var = $this->Config()->get('form_data_session_variable'); |
451
|
|
|
$retrieveDataPrimary = \Session::get($var.'_PrimaryForm'); |
452
|
|
|
if ($retrieveDataPrimary && (is_array($retrieveDataPrimary) || is_object($retrieveDataPrimary))) { |
|
|
|
|
453
|
|
|
//do nothing |
454
|
|
|
} else { |
455
|
|
|
$retrieveDataPrimary = []; |
456
|
|
|
} |
457
|
|
|
$retrieveDataSecondary = \Session::get($var.'_SecondaryForm'); |
458
|
|
|
if ($retrieveDataSecondary && (is_array($retrieveDataSecondary) || is_object($retrieveDataSecondary))) { |
|
|
|
|
459
|
|
|
//do nothing |
460
|
|
|
} else { |
461
|
|
|
$retrieveDataSecondary = []; |
462
|
|
|
} |
463
|
|
|
$this->_data = $retrieveDataPrimary + $retrieveDataSecondary; |
464
|
|
|
} |
465
|
|
|
|
466
|
|
|
return $this->_data; |
467
|
|
|
} |
468
|
|
|
|
469
|
|
|
private $_processed_data = null; |
470
|
|
|
|
471
|
|
|
protected function processedFormData($data = null) { |
|
|
|
|
472
|
|
|
if(! $this->_processed_data) { |
473
|
|
|
if(! $data) { |
474
|
|
|
$data = $this->retrieveData(); |
475
|
|
|
} |
476
|
|
|
$array = []; |
477
|
|
|
foreach($data as $key => $value) { |
478
|
|
|
if($key && $value) { |
479
|
|
|
if( |
480
|
|
|
strpos($key, '__KEY__') || |
481
|
|
|
strpos($key, '__VALUE__') |
482
|
|
|
) { |
483
|
|
|
$parts = explode('__', $key); |
484
|
|
|
if(!isset($array[$parts[0]])) { |
485
|
|
|
$array[$parts[0]] = []; |
486
|
|
|
} |
487
|
|
|
if(! isset($array[$parts[0]][$parts[2]])) { |
488
|
|
|
$array[$parts[0]][$parts[2]] = []; |
489
|
|
|
} |
490
|
|
|
$array[$parts[0]][$parts[2]][$parts[1]] = $value; |
491
|
|
|
} elseif(substr($key, 0, 3) === 'can') { |
492
|
|
|
$array[$key] = $this->MyCanMethodBuilder($key, $value); |
493
|
|
|
} else { |
494
|
|
|
$array[$key] = $value; |
495
|
|
|
} |
496
|
|
|
} |
497
|
|
|
} |
498
|
|
|
foreach($array as $field => $values) { |
499
|
|
|
$alInner = \ArrayList::create(); |
500
|
|
|
if(is_array($values)) { |
501
|
|
|
foreach($values as $key => $valuePairs) { |
502
|
|
|
if(isset($valuePairs['KEY']) && isset($valuePairs['VALUE'])) { |
503
|
|
|
if($valuePairs['VALUE'] == 'true') { |
504
|
|
|
$valuePairArray = [ |
505
|
|
|
'Key' => $valuePairs['KEY'], |
506
|
|
|
'UnquotedValue' => $valuePairs['VALUE'], |
507
|
|
|
]; |
508
|
|
|
} else { |
509
|
|
|
$valuePairArray = [ |
510
|
|
|
'Key' => $valuePairs['KEY'], |
511
|
|
|
'Value' => $valuePairs['VALUE'], |
512
|
|
|
]; |
513
|
|
|
} |
514
|
|
|
$alInner->push(\ArrayData::create($valuePairArray)); |
515
|
|
|
} |
516
|
|
|
} |
517
|
|
|
$array[$field] = $alInner; |
518
|
|
|
} else { |
|
|
|
|
519
|
|
|
//do nothing |
520
|
|
|
} |
521
|
|
|
} |
522
|
|
|
$this->_processed_data = \ArrayData::create($array); |
523
|
|
|
} |
524
|
|
|
|
525
|
|
|
return $this->_processed_data; |
526
|
|
|
} |
527
|
|
|
|
528
|
|
|
|
529
|
|
|
protected function resultsTemplateForBuilder() |
530
|
|
|
{ |
531
|
|
|
return str_replace(__NAMESPACE__ .'\\', '', $this->class).'Results'; |
532
|
|
|
} |
533
|
|
|
|
534
|
|
|
|
535
|
|
|
protected function prependNullOption($source) |
536
|
|
|
{ |
537
|
|
|
$source = ['' => '--- Please Select ---'] + $source; |
538
|
|
|
|
539
|
|
|
return $source; |
540
|
|
|
} |
541
|
|
|
|
542
|
|
|
|
543
|
|
|
protected function myAPI() |
|
|
|
|
544
|
|
|
{ |
545
|
|
|
$class = $this->apiProvider; |
546
|
|
|
|
547
|
|
|
return $class::inst($this->myBaseClass, $this->processedFormData()); |
548
|
|
|
} |
549
|
|
|
|
550
|
|
|
|
551
|
|
|
} |
552
|
|
|
|
This check marks private properties in classes that are never used. Those properties can be removed.