Skip to content

Commit 6389a65

Browse files
authored
fix #4201 【カスタムコンテンツ】特定のカスタムコンテンツでプレビューを押すとエラーになる問題を解決
1 parent 5113fe8 commit 6389a65

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

plugins/bc-custom-content/src/Service/Front/CustomContentFrontService.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,11 +364,17 @@ public function setupPreviewForView(Controller $controller): void
364364
}
365365

366366
$events = BcUtil::offEvent($customEntriesTable->getEventManager(), 'Model.beforeMarshal');
367-
$entity = $customEntriesTable->saveTmpFiles($postEntity, mt_rand(0, 99999999));
367+
368+
if ($postEntity && $customEntriesTable->hasBehavior('BcUpload')) {
369+
// BcUpload ビヘイビアがある場合は、アップロードファイルを保存
370+
$entity = $customEntriesTable->saveTmpFiles($postEntity, mt_rand(0, 99999999));
371+
$postEntity = $entity->toArray();
372+
}
368373
$entity = $customEntriesTable->patchEntity(
369374
$customEntry ?? $customEntriesTable->newEmptyEntity(),
370-
($postEntity)? $entity->toArray(): []
375+
$postEntity
371376
);
377+
372378
BcUtil::onEvent($customEntriesTable->getEventManager(), 'Model.beforeMarshal', $events);
373379

374380
$entity = $customEntriesTable->decodeRow($entity);

0 commit comments

Comments
 (0)