Skip to content

Commit

Permalink
fix #3084 【カスタムコンテンツ】「関連データ」を設定しても関連先フロントではタイトルしか取得できない問題 (#3380)
Browse files Browse the repository at this point in the history
Co-authored-by: Đỗ Văn Hùng <[email protected]>
  • Loading branch information
HungDV2022 and dovanhung authored Apr 29, 2024
1 parent 4af29f8 commit 7238794
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,20 @@ public function searchControl(CustomLink $link, array $options = []): string
*/
public function get($fieldValue, CustomLink $link, array $options = [])
{
if(!$fieldValue) return '';
$options = array_merge([
'getRelatedBody' => false
], $options);

if (!$fieldValue) return '';

/** @var CustomEntriesServiceInterface $entriesService */
$entriesService = $this->getService(CustomEntriesServiceInterface::class);
$entriesService->setup($link->custom_field->meta['BcCcRelated']['custom_table_id']);
$entry = $entriesService->get($fieldValue, ['contain' => 'CustomTables']);

if ($options['getRelatedBody'])
return $entry;

return $entry->{$entry->custom_table->display_field};
}

Expand Down

0 comments on commit 7238794

Please sign in to comment.