mirror of
https://github.com/getgrav/grav.git
synced 2026-02-23 07:01:26 +01:00
Fixed uploading media in non-existing flex object (part 2)
This commit is contained in:
@@ -618,6 +618,10 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
|
||||
|
||||
$result = $storage->replaceRows([$storageKey => $this->prepareStorage()]);
|
||||
|
||||
if (method_exists($this, 'clearMediaCache')) {
|
||||
$this->clearMediaCache();
|
||||
}
|
||||
|
||||
$value = reset($result);
|
||||
$meta = $value['__META'] ?? null;
|
||||
if ($meta) {
|
||||
|
||||
@@ -206,6 +206,10 @@ trait FlexMediaTrait
|
||||
{
|
||||
$updated = false;
|
||||
foreach ($this->getUpdatedMedia() as $filename => $upload) {
|
||||
if (is_array($upload)) {
|
||||
// Uses new format with [UploadedFileInterface, array].
|
||||
$upload = $upload[0];
|
||||
}
|
||||
if ($upload) {
|
||||
$medium = MediumFactory::fromUploadedFile($upload);
|
||||
if ($medium) {
|
||||
|
||||
Reference in New Issue
Block a user