|
4 | 4 |
|
5 | 5 | use A17\Twill\Services\Forms\Contracts\CanHaveSubfields; |
6 | 6 | use A17\Twill\Services\Forms\Contracts\CanRenderForBlocks; |
| 7 | +use A17\Twill\Services\Forms\Traits\HasSubFields; |
7 | 8 | use A17\Twill\Services\Forms\Traits\RenderForBlocks; |
8 | 9 | use Illuminate\Contracts\View\View; |
9 | 10 | use Illuminate\Support\Collection; |
|
12 | 13 | class Columns implements CanHaveSubfields, CanRenderForBlocks |
13 | 14 | { |
14 | 15 | use RenderForBlocks; |
| 16 | + use HasSubFields; |
15 | 17 |
|
16 | 18 | protected function __construct( |
17 | 19 | public ?Collection $left = null, |
@@ -66,37 +68,8 @@ public function render(): View |
66 | 68 |
|
67 | 69 | public function registerDynamicRepeaters(): void |
68 | 70 | { |
69 | | - if ($this->left) { |
70 | | - foreach ($this->left as $field) { |
71 | | - if ($field instanceof InlineRepeater) { |
72 | | - $field->register(); |
73 | | - } |
74 | | - if ($field instanceof CanHaveSubfields) { |
75 | | - $field->registerDynamicRepeaters(); |
76 | | - } |
77 | | - } |
78 | | - } |
79 | | - |
80 | | - if ($this->middle) { |
81 | | - foreach ($this->middle as $field) { |
82 | | - if ($field instanceof InlineRepeater) { |
83 | | - $field->register(); |
84 | | - } |
85 | | - if ($field instanceof CanHaveSubfields) { |
86 | | - $field->registerDynamicRepeaters(); |
87 | | - } |
88 | | - } |
89 | | - } |
90 | | - |
91 | | - if ($this->right) { |
92 | | - foreach ($this->right as $field) { |
93 | | - if ($field instanceof InlineRepeater) { |
94 | | - $field->register(); |
95 | | - } |
96 | | - if ($field instanceof CanHaveSubfields) { |
97 | | - $field->registerDynamicRepeaters(); |
98 | | - } |
99 | | - } |
100 | | - } |
| 71 | + $this->registerDynamicRepeatersFor($this->left); |
| 72 | + $this->registerDynamicRepeatersFor($this->middle); |
| 73 | + $this->registerDynamicRepeatersFor($this->right); |
101 | 74 | } |
102 | 75 | } |
0 commit comments