Skip to content

Commit

Permalink
Fix skipCreateModal option on submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
ifox committed Jul 20, 2020
1 parent 053c4ea commit 2474ae5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Http/Controllers/Admin/ModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ public function edit($id, $submoduleId = null)
* @param int|null $submoduleId
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse|\Illuminate\View\View
*/
public function create()
public function create($parentModuleId = null)
{
if (!$this->getIndexOption('skipCreateModal')) {
return Redirect::to(moduleRoute(
Expand All @@ -464,6 +464,8 @@ public function create()
['openCreate' => true]
));
}
$this->submodule = isset($parentModuleId);
$this->submoduleParentId = $parentModuleId;

$view = Collection::make([
"$this->viewPrefix.form",
Expand Down Expand Up @@ -1434,7 +1436,7 @@ protected function form($id, $item = null)
'form_fields' => $this->repository->getFormFields($item),
'baseUrl' => $baseUrl,
'permalinkPrefix' => $this->getPermalinkPrefix($baseUrl),
'saveUrl' => $item->id ? $this->getModuleRoute($item->id, 'update') : moduleRoute($this->moduleName, $this->routePrefix, 'store'),
'saveUrl' => $item->id ? $this->getModuleRoute($item->id, 'update') : moduleRoute($this->moduleName, $this->routePrefix, 'store', [$this->submoduleParentId]),
'editor' => Config::get('twill.enabled.block-editor') && $this->moduleHas('blocks') && !$this->disableEditor,
'blockPreviewUrl' => Route::has('admin.blocks.preview') ? URL::route('admin.blocks.preview') : '#',
'availableRepeaters' => $this->getRepeaterList()->toJson(),
Expand Down

0 comments on commit 2474ae5

Please sign in to comment.