|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace SleepingOwl\Admin\Form; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\View\View; |
|
6
|
|
|
use Illuminate\Database\Eloquent\Model; |
|
7
|
|
|
use SleepingOwl\Admin\Form\Buttons\Save; |
|
8
|
|
|
use SleepingOwl\Admin\Traits\Renderable; |
|
9
|
|
|
use KodiComponents\Support\HtmlAttributes; |
|
10
|
|
|
use SleepingOwl\Admin\Form\Buttons\Cancel; |
|
11
|
|
|
use SleepingOwl\Admin\Form\Buttons\Delete; |
|
12
|
|
|
use SleepingOwl\Admin\Form\Buttons\FormButton; |
|
13
|
|
|
use SleepingOwl\Admin\Form\Buttons\SaveAndClose; |
|
14
|
|
|
use SleepingOwl\Admin\Form\Buttons\SaveAndCreate; |
|
15
|
|
|
use SleepingOwl\Admin\Contracts\Form\FormButtonsInterface; |
|
16
|
|
|
use SleepingOwl\Admin\Contracts\ModelConfigurationInterface; |
|
17
|
|
|
|
|
18
|
|
|
class FormButtons implements FormButtonsInterface |
|
19
|
|
|
{ |
|
20
|
|
|
use HtmlAttributes, Renderable; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @var |
|
24
|
|
|
*/ |
|
25
|
|
|
protected $placements; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @var string|null|array |
|
29
|
|
|
*/ |
|
30
|
|
|
protected $cancelButtonText; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @var string|null|array |
|
34
|
|
|
*/ |
|
35
|
|
|
protected $saveButtonText; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @var string|null|array |
|
39
|
|
|
*/ |
|
40
|
|
|
protected $saveAndCloseButtonText; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @var string|null|array |
|
44
|
|
|
*/ |
|
45
|
|
|
protected $saveAndCreateButtonText; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @var string|null|array |
|
49
|
|
|
*/ |
|
50
|
|
|
protected $deleteButtonText; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @var string|null|array |
|
54
|
|
|
*/ |
|
55
|
|
|
protected $destroyButtonText; |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @var string|null|array |
|
59
|
|
|
*/ |
|
60
|
|
|
protected $restoreButtonText; |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @var bool |
|
64
|
|
|
*/ |
|
65
|
|
|
protected $showCancelButton = true; |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* @var bool |
|
69
|
|
|
*/ |
|
70
|
|
|
protected $showSaveAndCloseButton = true; |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @var bool |
|
74
|
|
|
*/ |
|
75
|
|
|
protected $showSaveAndCreateButton = true; |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* @var bool|null |
|
79
|
|
|
*/ |
|
80
|
|
|
protected $showDeleteButton = true; |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* @var bool|null |
|
84
|
|
|
*/ |
|
85
|
|
|
protected $showDestroyButton = true; |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* @var bool|null |
|
89
|
|
|
*/ |
|
90
|
|
|
protected $showRestoreButton = true; |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* @var ModelConfigurationInterface |
|
94
|
|
|
*/ |
|
95
|
|
|
protected $modelConfiguration; |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* @var Model |
|
99
|
|
|
*/ |
|
100
|
|
|
protected $model; |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* @var string|View |
|
104
|
|
|
*/ |
|
105
|
|
|
protected $view = 'form.buttons'; |
|
106
|
|
|
|
|
107
|
|
|
protected $buttons; |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* FormButtons constructor. |
|
111
|
|
|
*/ |
|
112
|
10 |
|
public function __construct() |
|
113
|
|
|
{ |
|
114
|
10 |
|
$this->setHtmlAttribute('class', 'form-buttons'); |
|
115
|
10 |
|
$this->setButtonsOnConstruct(); |
|
116
|
10 |
|
} |
|
117
|
|
|
|
|
118
|
|
|
/** |
|
119
|
|
|
* @return array |
|
120
|
|
|
*/ |
|
121
|
|
|
protected function getButtons() |
|
122
|
|
|
{ |
|
123
|
|
|
foreach ($this->buttons as $button) { |
|
124
|
|
|
if ($button instanceof FormButton) { |
|
125
|
|
|
$button->setModelConfiguration($this->getModelConfiguration()); |
|
126
|
|
|
$button->setModel($this->getModel()); |
|
127
|
|
|
if ($button->getGroupElements()) { |
|
128
|
|
|
foreach ($button->getGroupElements() as $groupButton) { |
|
129
|
|
|
if ($groupButton instanceof FormButton) { |
|
130
|
|
|
$groupButton->setModelConfiguration($this->getModelConfiguration()); |
|
131
|
|
|
$groupButton->setModel($this->getModel()); |
|
132
|
|
|
$groupButton->initialize(); |
|
133
|
|
|
} |
|
134
|
|
|
} |
|
135
|
|
|
} |
|
136
|
|
|
$button->initialize(); |
|
137
|
|
|
} |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
return $this->buttons; |
|
141
|
|
|
} |
|
142
|
|
|
|
|
143
|
|
|
/** |
|
144
|
|
|
* @param $buttons |
|
145
|
|
|
* @return $this |
|
146
|
|
|
*/ |
|
147
|
|
|
public function setButtons($buttons) |
|
148
|
|
|
{ |
|
149
|
|
|
$this->buttons = $buttons; |
|
150
|
|
|
|
|
151
|
|
|
return $this; |
|
152
|
|
|
} |
|
153
|
|
|
|
|
154
|
|
|
/** |
|
155
|
|
|
* @param $buttons |
|
156
|
|
|
* @return $this |
|
157
|
|
|
*/ |
|
158
|
|
|
public function replaceButtons($buttons) |
|
159
|
|
|
{ |
|
160
|
|
|
foreach ($buttons as $tempName => $tempButton) { |
|
161
|
|
|
foreach ($this->buttons as $name => $button) { |
|
162
|
|
|
if ($tempName == $name) { |
|
163
|
|
|
$this->buttons[$name] = $tempButton; |
|
164
|
|
|
} |
|
165
|
|
|
|
|
166
|
|
|
if ($button instanceof FormButton) { |
|
167
|
|
|
if ($button->getGroupElements()) { |
|
168
|
|
|
foreach ($button->getGroupElements() as $groupName => $groupButton) { |
|
169
|
|
|
if ($groupName == $tempName) { |
|
170
|
|
|
$button->setGroupElement($groupName, $tempButton); |
|
171
|
|
|
} |
|
172
|
|
|
} |
|
173
|
|
|
} |
|
174
|
|
|
} |
|
175
|
|
|
} |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
return $this; |
|
179
|
|
|
} |
|
180
|
|
|
|
|
181
|
|
|
/** |
|
182
|
|
|
* @param $placements |
|
183
|
|
|
* @return $this |
|
184
|
|
|
*/ |
|
185
|
|
|
public function setPlacements($placements) |
|
186
|
|
|
{ |
|
187
|
|
|
$this->placements = $placements; |
|
188
|
|
|
|
|
189
|
|
|
return $this; |
|
190
|
|
|
} |
|
191
|
|
|
|
|
192
|
|
|
/** |
|
193
|
|
|
* @return mixed |
|
194
|
|
|
*/ |
|
195
|
|
|
public function getPlacements() |
|
196
|
|
|
{ |
|
197
|
|
|
return $this->placements; |
|
198
|
|
|
} |
|
199
|
|
|
|
|
200
|
|
|
/** |
|
201
|
|
|
* Set start buttons. Default logic. |
|
202
|
|
|
*/ |
|
203
|
10 |
|
protected function setButtonsOnConstruct() |
|
204
|
|
|
{ |
|
205
|
10 |
|
$this->buttons = [ |
|
206
|
10 |
|
'save' => (new Save())->setGroupElements([ |
|
207
|
10 |
|
'save_and_create' => new SaveAndCreate(), |
|
208
|
10 |
|
'save_and_close' => new SaveAndClose(), |
|
209
|
10 |
|
]), |
|
210
|
10 |
|
'delete' => new Delete(), |
|
211
|
10 |
|
'cancel' => new Cancel(), |
|
212
|
|
|
]; |
|
213
|
10 |
|
} |
|
214
|
|
|
|
|
215
|
|
|
/** |
|
216
|
|
|
* @return bool|\Illuminate\Database\Eloquent\Builder |
|
217
|
|
|
*/ |
|
218
|
|
|
protected function isTrashed() |
|
219
|
|
|
{ |
|
220
|
|
|
return method_exists($this->getModel(), 'trashed') ? $this->getModel()->trashed() : false; |
|
221
|
|
|
} |
|
222
|
|
|
|
|
223
|
|
|
/** |
|
224
|
|
|
* @deprecated new version available |
|
225
|
|
|
* @return null|string|array |
|
226
|
|
|
*/ |
|
227
|
|
|
public function getCancelButtonText() |
|
228
|
|
|
{ |
|
229
|
|
|
if (is_null($this->cancelButtonText)) { |
|
230
|
|
|
$this->cancelButtonText = trans('sleeping_owl::lang.table.cancel'); |
|
231
|
|
|
} |
|
232
|
|
|
|
|
233
|
|
|
return $this->cancelButtonText; |
|
234
|
|
|
} |
|
235
|
|
|
|
|
236
|
|
|
/** |
|
237
|
|
|
* @param string $cancelButtonText |
|
238
|
|
|
* @deprecated new version available |
|
239
|
|
|
* @return $this |
|
240
|
|
|
*/ |
|
241
|
|
|
public function setCancelButtonText($cancelButtonText) |
|
242
|
|
|
{ |
|
243
|
|
|
$this->cancelButtonText = $cancelButtonText; |
|
244
|
|
|
|
|
245
|
|
|
return $this; |
|
246
|
|
|
} |
|
247
|
|
|
|
|
248
|
|
|
/** |
|
249
|
|
|
* @deprecated new version available |
|
250
|
|
|
* @return string|array |
|
251
|
|
|
*/ |
|
252
|
|
|
public function getSaveButtonText() |
|
253
|
|
|
{ |
|
254
|
|
|
if (is_null($this->saveButtonText)) { |
|
255
|
|
|
$this->saveButtonText = trans('sleeping_owl::lang.table.save'); |
|
256
|
|
|
} |
|
257
|
|
|
|
|
258
|
|
|
return $this->saveButtonText; |
|
259
|
|
|
} |
|
260
|
|
|
|
|
261
|
|
|
/** |
|
262
|
|
|
* @param string $saveButtonText |
|
263
|
|
|
* @deprecated |
|
264
|
|
|
* @return $this |
|
265
|
|
|
*/ |
|
266
|
|
|
public function setSaveButtonText($saveButtonText) |
|
267
|
|
|
{ |
|
268
|
|
|
$this->saveButtonText = $saveButtonText; |
|
269
|
|
|
|
|
270
|
|
|
return $this; |
|
271
|
|
|
} |
|
272
|
|
|
|
|
273
|
|
|
/** |
|
274
|
|
|
* @deprecated new version available |
|
275
|
|
|
* @return string|array |
|
276
|
|
|
*/ |
|
277
|
|
|
public function getSaveAndCloseButtonText() |
|
278
|
|
|
{ |
|
279
|
|
|
if (is_null($this->saveAndCloseButtonText)) { |
|
280
|
|
|
$this->saveAndCloseButtonText = trans('sleeping_owl::lang.table.save_and_close'); |
|
281
|
|
|
} |
|
282
|
|
|
|
|
283
|
|
|
return $this->saveAndCloseButtonText; |
|
284
|
|
|
} |
|
285
|
|
|
|
|
286
|
|
|
/** |
|
287
|
|
|
* @param string $saveAndCloseButtonText |
|
288
|
|
|
* |
|
289
|
|
|
* @deprecated new version available |
|
290
|
|
|
* @return $this |
|
291
|
|
|
*/ |
|
292
|
|
|
public function setSaveAndCloseButtonText($saveAndCloseButtonText) |
|
293
|
|
|
{ |
|
294
|
|
|
$this->saveAndCloseButtonText = $saveAndCloseButtonText; |
|
295
|
|
|
|
|
296
|
|
|
return $this; |
|
297
|
|
|
} |
|
298
|
|
|
|
|
299
|
|
|
/** |
|
300
|
|
|
* @deprecated new version available |
|
301
|
|
|
* @return string|array |
|
302
|
|
|
*/ |
|
303
|
|
|
public function getSaveAndCreateButtonText() |
|
304
|
|
|
{ |
|
305
|
|
|
if (is_null($this->saveAndCreateButtonText)) { |
|
306
|
|
|
$this->saveAndCreateButtonText = trans('sleeping_owl::lang.table.save_and_create'); |
|
307
|
|
|
} |
|
308
|
|
|
|
|
309
|
|
|
return $this->saveAndCreateButtonText; |
|
310
|
|
|
} |
|
311
|
|
|
|
|
312
|
|
|
/** |
|
313
|
|
|
* @param null|string $saveAndCreateButtonText |
|
314
|
|
|
* |
|
315
|
|
|
* @deprecated new version available |
|
316
|
|
|
* @return $this |
|
317
|
|
|
*/ |
|
318
|
|
|
public function setSaveAndCreateButtonText($saveAndCreateButtonText) |
|
319
|
|
|
{ |
|
320
|
|
|
$this->saveAndCreateButtonText = $saveAndCreateButtonText; |
|
321
|
|
|
|
|
322
|
|
|
return $this; |
|
323
|
|
|
} |
|
324
|
|
|
|
|
325
|
|
|
/** |
|
326
|
|
|
* @deprecated new version available |
|
327
|
|
|
* @return string|array |
|
328
|
|
|
*/ |
|
329
|
|
|
public function getDeleteButtonText() |
|
330
|
|
|
{ |
|
331
|
|
|
if (is_null($this->deleteButtonText)) { |
|
332
|
|
|
$this->deleteButtonText = trans('sleeping_owl::lang.table.delete'); |
|
333
|
|
|
} |
|
334
|
|
|
|
|
335
|
|
|
return $this->deleteButtonText; |
|
336
|
|
|
} |
|
337
|
|
|
|
|
338
|
|
|
/** |
|
339
|
|
|
* @param null|string $deleteButtonText |
|
340
|
|
|
* @deprecated new version available |
|
341
|
|
|
* @return $this |
|
342
|
|
|
*/ |
|
343
|
|
|
public function setDeleteButtonText($deleteButtonText) |
|
344
|
|
|
{ |
|
345
|
|
|
$this->deleteButtonText = $deleteButtonText; |
|
346
|
|
|
|
|
347
|
|
|
return $this; |
|
348
|
|
|
} |
|
349
|
|
|
|
|
350
|
|
|
/** |
|
351
|
|
|
* @deprecated new version available |
|
352
|
|
|
* @return null|string|array |
|
353
|
|
|
*/ |
|
354
|
|
|
public function getDestroyButtonText() |
|
355
|
|
|
{ |
|
356
|
|
|
if (is_null($this->destroyButtonText)) { |
|
357
|
|
|
$this->destroyButtonText = trans('sleeping_owl::lang.table.destroy'); |
|
358
|
|
|
} |
|
359
|
|
|
|
|
360
|
|
|
return $this->destroyButtonText; |
|
361
|
|
|
} |
|
362
|
|
|
|
|
363
|
|
|
/** |
|
364
|
|
|
* @deprecated new version available |
|
365
|
|
|
* @param null|string $destroyButtonText |
|
366
|
|
|
*/ |
|
367
|
|
|
public function setDestroyButtonText($destroyButtonText) |
|
368
|
|
|
{ |
|
369
|
|
|
$this->destroyButtonText = $destroyButtonText; |
|
370
|
|
|
} |
|
371
|
|
|
|
|
372
|
|
|
/** |
|
373
|
|
|
* @deprecated new version available |
|
374
|
|
|
* @return string |
|
375
|
|
|
*/ |
|
376
|
|
|
public function getRestoreButtonText() |
|
377
|
|
|
{ |
|
378
|
|
|
if (is_null($this->restoreButtonText)) { |
|
379
|
|
|
$this->restoreButtonText = trans('sleeping_owl::lang.table.restore'); |
|
380
|
|
|
} |
|
381
|
|
|
|
|
382
|
|
|
return $this->restoreButtonText; |
|
|
|
|
|
|
383
|
|
|
} |
|
384
|
|
|
|
|
385
|
|
|
/** |
|
386
|
|
|
* @deprecated new version available |
|
387
|
|
|
* @param null|string $restoreButtonText |
|
388
|
|
|
*/ |
|
389
|
|
|
public function setRestoreButtonText($restoreButtonText) |
|
390
|
|
|
{ |
|
391
|
|
|
$this->restoreButtonText = $restoreButtonText; |
|
392
|
|
|
} |
|
393
|
|
|
|
|
394
|
|
|
/** |
|
395
|
|
|
* @deprecated new version available |
|
396
|
|
|
* @return bool |
|
397
|
|
|
*/ |
|
398
|
|
|
public function isShowCancelButton() |
|
399
|
|
|
{ |
|
400
|
|
|
return $this->showCancelButton; |
|
401
|
|
|
} |
|
402
|
|
|
|
|
403
|
|
|
/** |
|
404
|
|
|
* @deprecated new version available |
|
405
|
|
|
* @return $this |
|
406
|
|
|
*/ |
|
407
|
|
|
public function hideCancelButton() |
|
408
|
|
|
{ |
|
409
|
|
|
$this->showCancelButton = false; |
|
410
|
|
|
|
|
411
|
|
|
return $this; |
|
412
|
|
|
} |
|
413
|
|
|
|
|
414
|
|
|
/** |
|
415
|
|
|
* @deprecated new version available |
|
416
|
|
|
* @return bool |
|
417
|
|
|
*/ |
|
418
|
|
|
public function isShowSaveAndCloseButton() |
|
419
|
|
|
{ |
|
420
|
|
|
return $this->showSaveAndCloseButton; |
|
421
|
|
|
} |
|
422
|
|
|
|
|
423
|
|
|
/** |
|
424
|
|
|
* @deprecated new version available |
|
425
|
|
|
* @return $this |
|
426
|
|
|
*/ |
|
427
|
|
|
public function hideSaveAndCloseButton() |
|
428
|
|
|
{ |
|
429
|
|
|
$this->showSaveAndCloseButton = false; |
|
430
|
|
|
|
|
431
|
|
|
return $this; |
|
432
|
|
|
} |
|
433
|
|
|
|
|
434
|
|
|
/** |
|
435
|
|
|
* @deprecated new version available |
|
436
|
|
|
* @return bool |
|
437
|
|
|
*/ |
|
438
|
|
|
public function isShowSaveAndCreateButton() |
|
439
|
|
|
{ |
|
440
|
|
|
return $this->showSaveAndCreateButton; |
|
441
|
|
|
} |
|
442
|
|
|
|
|
443
|
|
|
/** |
|
444
|
|
|
* @deprecated new version available |
|
445
|
|
|
* @return $this |
|
446
|
|
|
*/ |
|
447
|
|
|
public function hideSaveAndCreateButton() |
|
448
|
|
|
{ |
|
449
|
|
|
$this->showSaveAndCreateButton = false; |
|
450
|
|
|
|
|
451
|
|
|
return $this; |
|
452
|
|
|
} |
|
453
|
|
|
|
|
454
|
|
|
/** |
|
455
|
|
|
* @deprecated new version available |
|
456
|
|
|
* @return bool|null |
|
457
|
|
|
*/ |
|
458
|
|
|
public function isShowDeleteButton() |
|
459
|
|
|
{ |
|
460
|
|
|
if (is_null($this->getModel()->getKey()) || ! $this->showDeleteButton) { |
|
|
|
|
|
|
461
|
|
|
return false; |
|
462
|
|
|
} |
|
463
|
|
|
|
|
464
|
|
|
$this->showDeleteButton = ! $this->isTrashed() && $this->getModelConfiguration()->isDeletable($this->getModel()); |
|
465
|
|
|
|
|
466
|
|
|
return $this->showDeleteButton; |
|
467
|
|
|
} |
|
468
|
|
|
|
|
469
|
|
|
/** |
|
470
|
|
|
* @deprecated new version available |
|
471
|
|
|
* @return $this |
|
472
|
|
|
*/ |
|
473
|
|
|
public function hideDeleteButton() |
|
474
|
|
|
{ |
|
475
|
|
|
$this->showDeleteButton = false; |
|
476
|
|
|
|
|
477
|
|
|
return $this; |
|
478
|
|
|
} |
|
479
|
|
|
|
|
480
|
|
|
/** |
|
481
|
|
|
* @deprecated new version available |
|
482
|
|
|
* @return bool|null |
|
483
|
|
|
*/ |
|
484
|
|
|
public function isShowDestroyButton() |
|
485
|
|
|
{ |
|
486
|
|
|
if (is_null($this->getModel()->getKey()) || ! $this->showDestroyButton) { |
|
|
|
|
|
|
487
|
|
|
return false; |
|
488
|
|
|
} |
|
489
|
|
|
|
|
490
|
|
|
$this->showDestroyButton = $this->isTrashed() && |
|
491
|
|
|
$this->getModelConfiguration()->isDestroyable($this->getModel()); |
|
492
|
|
|
|
|
493
|
|
|
return $this->showDestroyButton; |
|
494
|
|
|
} |
|
495
|
|
|
|
|
496
|
|
|
/** |
|
497
|
|
|
* @deprecated new version available |
|
498
|
|
|
* @return $this |
|
499
|
|
|
*/ |
|
500
|
|
|
public function hideDestroyButton() |
|
501
|
|
|
{ |
|
502
|
|
|
$this->showDestroyButton = false; |
|
503
|
|
|
|
|
504
|
|
|
return $this; |
|
505
|
|
|
} |
|
506
|
|
|
|
|
507
|
|
|
/** |
|
508
|
|
|
* @deprecated new version available |
|
509
|
|
|
* @return bool|null |
|
510
|
|
|
*/ |
|
511
|
|
|
public function isShowRestoreButton() |
|
512
|
|
|
{ |
|
513
|
|
|
if (is_null($this->getModel()->getKey()) || ! $this->showRestoreButton) { |
|
|
|
|
|
|
514
|
|
|
return false; |
|
515
|
|
|
} |
|
516
|
|
|
|
|
517
|
|
|
$this->showRestoreButton = $this->isTrashed() && |
|
518
|
|
|
$this->getModelConfiguration()->isRestorable($this->getModel()); |
|
519
|
|
|
|
|
520
|
|
|
return $this->showRestoreButton; |
|
521
|
|
|
} |
|
522
|
|
|
|
|
523
|
|
|
/** |
|
524
|
|
|
* @deprecated new version available |
|
525
|
|
|
* @return $this |
|
526
|
|
|
*/ |
|
527
|
|
|
public function hideRestoreButton() |
|
528
|
|
|
{ |
|
529
|
|
|
$this->showRestoreButton = false; |
|
530
|
|
|
|
|
531
|
|
|
return $this; |
|
532
|
|
|
} |
|
533
|
|
|
|
|
534
|
|
|
/** |
|
535
|
|
|
* @return array |
|
536
|
|
|
*/ |
|
537
|
|
|
public function toArray() |
|
538
|
|
|
{ |
|
539
|
|
|
return [ |
|
540
|
|
|
'attributes' => $this->htmlAttributesToString(), |
|
541
|
|
|
'backUrl' => $this->getModelConfiguration()->getCancelUrl(), |
|
542
|
|
|
'editUrl' => $this->getModelConfiguration()->getEditUrl($this->getModel()->getKey()), |
|
543
|
|
|
'deleteUrl' => $this->getModelConfiguration()->getDeleteUrl($this->getModel()->getKey()), |
|
544
|
|
|
'destroyUrl' => $this->getModelConfiguration()->getDestroyUrl($this->getModel()->getKey()), |
|
545
|
|
|
'restoreUrl' => $this->getModelConfiguration()->getRestoreUrl($this->getModel()->getKey()), |
|
546
|
|
|
'saveButtonText' => $this->getSaveButtonText(), |
|
|
|
|
|
|
547
|
|
|
'saveAndCloseButtonText' => $this->getSaveAndCloseButtonText(), |
|
|
|
|
|
|
548
|
|
|
'saveAndCreateButtonText' => $this->getSaveAndCreateButtonText(), |
|
|
|
|
|
|
549
|
|
|
'cancelButtonText' => $this->getCancelButtonText(), |
|
|
|
|
|
|
550
|
|
|
'deleteButtonText' => $this->getDeleteButtonText(), |
|
|
|
|
|
|
551
|
|
|
'destroyButtonText' => $this->getDestroyButtonText(), |
|
|
|
|
|
|
552
|
|
|
'restoreButtonText' => $this->getRestoreButtonText(), |
|
|
|
|
|
|
553
|
|
|
'showCancelButton' => $this->isShowCancelButton(), |
|
|
|
|
|
|
554
|
|
|
'showSaveAndCloseButton' => $this->isShowSaveAndCloseButton(), |
|
|
|
|
|
|
555
|
|
|
'showSaveAndCreateButton' => $this->isShowSaveAndCreateButton(), |
|
|
|
|
|
|
556
|
|
|
'showDeleteButton' => $this->isShowDeleteButton(), |
|
|
|
|
|
|
557
|
|
|
'showDestroyButton' => $this->isShowDestroyButton(), |
|
|
|
|
|
|
558
|
|
|
'showRestoreButton' => $this->isShowRestoreButton(), |
|
|
|
|
|
|
559
|
|
|
'buttons' => $this->getButtons(), |
|
560
|
|
|
'placements' => $this->getPlacements(), |
|
561
|
|
|
]; |
|
562
|
|
|
} |
|
563
|
|
|
|
|
564
|
|
|
/** |
|
565
|
|
|
* @param ModelConfigurationInterface $modelConfiguration |
|
566
|
|
|
* |
|
567
|
|
|
* @return $this |
|
568
|
|
|
*/ |
|
569
|
3 |
|
public function setModelConfiguration(ModelConfigurationInterface $modelConfiguration) |
|
570
|
|
|
{ |
|
571
|
3 |
|
$this->modelConfiguration = $modelConfiguration; |
|
572
|
|
|
|
|
573
|
3 |
|
return $this; |
|
574
|
|
|
} |
|
575
|
|
|
|
|
576
|
|
|
/** |
|
577
|
|
|
* @return ModelConfigurationInterface |
|
578
|
|
|
*/ |
|
579
|
|
|
public function getModelConfiguration() |
|
580
|
|
|
{ |
|
581
|
|
|
return $this->modelConfiguration; |
|
582
|
|
|
} |
|
583
|
|
|
|
|
584
|
|
|
/** |
|
585
|
|
|
* @return Model |
|
586
|
|
|
*/ |
|
587
|
|
|
public function getModel() |
|
588
|
|
|
{ |
|
589
|
|
|
return $this->model; |
|
590
|
|
|
} |
|
591
|
|
|
|
|
592
|
|
|
/** |
|
593
|
|
|
* @param Model $model |
|
594
|
|
|
* |
|
595
|
|
|
* @return $this |
|
596
|
|
|
*/ |
|
597
|
3 |
|
public function setModel(Model $model) |
|
598
|
|
|
{ |
|
599
|
3 |
|
$this->model = $model; |
|
600
|
|
|
|
|
601
|
3 |
|
return $this; |
|
602
|
|
|
} |
|
603
|
|
|
} |
|
604
|
|
|
|