Skip to content

Commit 90e577e

Browse files
committed
エントリーリスト取得条件のデフォルト値追加と、currentContentが取得できていない問題を解消
1 parent 9bb2cb1 commit 90e577e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

plugins/bc-custom-content/src/View/Helper/CustomContentHelper.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,13 +506,18 @@ public function getEntries(string $contentsName, int $limit = 5, array $options
506506
{
507507
$options = array_merge([
508508
'limit' => $limit,
509+
'status' => 'publish',
510+
'order' => 'created',
511+
'direction' => 'DESC',
509512
], $options);
510513
$contentService = $this->getService(ContentsServiceInterface::class);
511514
$url = $this->parseContentsName($contentsName);
512515
$content = $contentService->Contents->findByUrl($url, ['Contain' => ['CustomContents']]);
513516
if($content->type !== 'CustomContent') {
514517
throw new NotFoundException(__d('baser_core', '指定されたコンテンツは存在しません。'));
515518
}
519+
$request = $this->getView()->getRequest()->withAttribute('currentContent', $content);
520+
$this->getView()->setRequest($request);
516521
$service = $this->getService(CustomContentFrontServiceInterface::class);
517522
$customContent = $service->ContentsService->get($content->entity_id);
518523
$service->EntriesService->setup($customContent->custom_table_id);

0 commit comments

Comments
 (0)