mirror of
https://github.com/getgrav/grav.git
synced 2026-07-09 03:33:47 +02:00
Improve file upload logic on flex objects
This commit is contained in:
@@ -496,12 +496,7 @@ class FlexForm implements FlexFormInterface
|
||||
{
|
||||
/** @var FlexObject $object */
|
||||
$object = clone $this->getObject();
|
||||
$object->update($data);
|
||||
|
||||
if ($files && method_exists($object, 'upload')) {
|
||||
$object->upload($files);
|
||||
}
|
||||
|
||||
$object->update($data, $files);
|
||||
$object->save();
|
||||
|
||||
$this->setObject($object);
|
||||
|
||||
@@ -118,10 +118,6 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
|
||||
// Validate and filter the incoming data.
|
||||
$blueprint = $this->getFlexDirectory()->getBlueprint();
|
||||
|
||||
if ($files && method_exists($this, 'updateMediaFiles')) {
|
||||
$this->updateMediaFiles($files);
|
||||
}
|
||||
|
||||
if ($data) {
|
||||
// Filter updated data.
|
||||
$this->filterElements($data);
|
||||
@@ -138,6 +134,10 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
|
||||
$this->setElements($data);
|
||||
}
|
||||
|
||||
if ($files && method_exists($this, 'updateMediaFiles')) {
|
||||
$this->updateMediaFiles($files);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user