9
9
use A17 \Twill \Services \Forms \Fields \Repeater ;
10
10
use A17 \Twill \Services \Forms \Traits \HasSubFields ;
11
11
use A17 \Twill \Services \Forms \Traits \RenderForBlocks ;
12
+ use A17 \Twill \Services \Forms \Fields \Traits \CanReorder ;
13
+ use A17 \Twill \Services \Forms \Fields \Traits \DisableActions ;
12
14
use Illuminate \Contracts \View \View ;
13
15
use Illuminate \Support \Collection ;
14
16
use Illuminate \Support \Str ;
@@ -17,6 +19,8 @@ class InlineRepeater implements CanHaveSubfields, CanRenderForBlocks
17
19
{
18
20
use RenderForBlocks;
19
21
use HasSubFields;
22
+ use CanReorder;
23
+ use DisableActions;
20
24
21
25
protected function __construct (
22
26
private ?string $ name = null ,
@@ -25,15 +29,14 @@ protected function __construct(
25
29
private ?Collection $ fields = null ,
26
30
private ?string $ label = null ,
27
31
private bool $ allowCreate = true ,
28
- private bool $ allowSortable = true ,
29
- private bool $ allowActions = true ,
30
32
private ?string $ relation = null ,
31
33
private ?bool $ allowBrowse = false ,
32
34
private ?array $ browser = null ,
33
35
private ?int $ max = null ,
34
36
private ?string $ titleField = null ,
35
37
private ?bool $ hideTitlePrefix = false ,
36
38
private ?bool $ buttonAsLink = false ,
39
+ private ?bool $ displayActions = true ,
37
40
protected ?array $ connectedTo = null ,
38
41
) {
39
42
}
@@ -97,20 +100,6 @@ public function disableCreate(bool $disableCreate = true): static
97
100
return $ this ;
98
101
}
99
102
100
- public function disableSortable (bool $ disableSortable = true ): static
101
- {
102
- $ this ->allowSortable = ! $ disableSortable ;
103
-
104
- return $ this ;
105
- }
106
-
107
- public function disableActions (bool $ disableActions = true ): static
108
- {
109
- $ this ->allowActions = ! $ disableActions ;
110
-
111
- return $ this ;
112
- }
113
-
114
103
/**
115
104
* The name of the module to use for selecting existing records. Not for json repeaters.
116
105
*/
@@ -223,8 +212,8 @@ public function render(): View
223
212
->name ($ this ->name )
224
213
->type ($ this ->getRenderName ())
225
214
->allowCreate ($ this ->allowCreate )
226
- ->allowSortable ( $ this ->allowSortable )
227
- ->allowActions ( $ this ->allowActions )
215
+ ->disableReorder (! $ this ->reorder )
216
+ ->disableActions (! $ this ->displayActions )
228
217
->relation ($ this ->relation ?? null )
229
218
->browserModule ($ this ->allowBrowse ? $ this ->browser : null );
230
219
0 commit comments