Reuse formWidget model (#4273)
Credit to @mjauvin. Related: https://github.com/octobercms/october/pull/4193
This commit is contained in:
parent
41a634bb2b
commit
ed79877054
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue