Reuse formWidget model (#4273)

Credit to @mjauvin. Related: https://github.com/octobercms/october/pull/4193
This commit is contained in:
Marc Jauvin 2019-04-18 14:44:05 -04:00 committed by Luke Towers
parent 41a634bb2b
commit ed79877054
1 changed files with 2 additions and 3 deletions

View File

@ -370,9 +370,8 @@ class FileUpload extends FormWidgetBase
public function onSaveAttachmentConfig()
{
try {
$fileModel = $this->getRelationModel();
if ($file = $this->getFileRecord()) {
$formWidget = $this->getConfigFormWidget();
$formWidget = $this->getConfigFormWidget();
if ($file = $formWidget->model) {
$modelsToSave = $this->prepareModelsToSave($file, $formWidget->getSaveData());
Db::transaction(function () use ($modelsToSave, $formWidget) {