Skip to content

Commit 31dc84d

Browse files
Tofandelifox
authored andcommitted
Fix repeaters are registered without a populated item
1 parent 669bed0 commit 31dc84d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Http/Controllers/Admin/ModuleController.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,7 @@ public function edit(TwillModelContract|int $id): mixed
12001200
$this->setBackLink();
12011201

12021202
$controllerForm = $this->getForm($item);
1203+
$controllerForm->registerDynamicRepeaters();
12031204

12041205
if ($controllerForm->hasForm()) {
12051206
$view = 'twill::layouts.form';
@@ -1221,8 +1222,11 @@ public function edit(TwillModelContract|int $id): mixed
12211222
}
12221223
}
12231224

1224-
return View::make($view, $this->form($id))->with(
1225-
['formBuilder' => $controllerForm->toFrontend($this->getSideFieldsets($item))]
1225+
$sideFieldsets = $this->getSideFieldsets($item);
1226+
$sideFieldsets->registerDynamicRepeaters();
1227+
1228+
return View::make($view, $this->form($id, $item))->with(
1229+
['formBuilder' => $controllerForm->toFrontend($sideFieldsets)]
12261230
);
12271231
}
12281232

@@ -1255,8 +1259,6 @@ public function create(int $parentModuleId = null): JsonResponse|RedirectRespons
12551259
return View::exists($view);
12561260
});
12571261

1258-
View::share('form', $this->form(null));
1259-
12601262
return View::make($view, $this->form(null))->with(
12611263
['formBuilder' => $controllerForm->toFrontend($this->getSideFieldsets($emptyModelInstance), true)]
12621264
);
@@ -1381,7 +1383,7 @@ public function preview(int $id): IlluminateView
13811383

13821384
/**
13831385
* @param int $id
1384-
* @return \Illuminate\View\View
1386+
* @return \Illuminate\Contracts\View\View
13851387
*/
13861388
public function restoreRevision($id)
13871389
{
@@ -1417,8 +1419,6 @@ public function restoreRevision($id)
14171419
);
14181420
}
14191421

1420-
View::share('form', $this->form($id, $item));
1421-
14221422
return View::make($view, $this->form($id, $item))->with(
14231423
['formBuilder' => $controllerForm->toFrontend($this->getSideFieldsets($item))]
14241424
);

0 commit comments

Comments
 (0)