Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions modules/backend/formwidgets/NestedForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use Backend\Classes\FormWidgetBase;
use Backend\Widgets\Form;
use Winter\Storm\Database\Model;

/**
* Nested Form
Expand Down Expand Up @@ -46,9 +47,23 @@ public function init()
$this->previewMode = true;
}

$nestedData = $this->getLoadValue();

$dummyModel = new class extends Model {
public function __get($key) {
return null;
}
public function __isset($key) {
return false;
}
public function exists() {
return false;
}
};

$config = $this->makeConfig($this->form);
$config->model = $this->model;
$config->data = $this->getLoadValue();
$config->model = $dummyModel;
$config->data = $nestedData ?: [];
$config->alias = $this->alias . $this->defaultAlias;
$config->arrayName = $this->getFieldName();
$config->isNested = true;
Expand Down