public function getEntityWith(string $style): array
{
$visitor = \XF::visitor();
$with = [
'Forum',
'Forum.Node.Permissions|' . $visitor->permission_combination_id,
'User',
];
if (in_array($style, ['article', 'carousel'], true))
{
$with[] = 'FirstPost';
}
return $with;
}
[...]
public function addAttachmentsToContent(AbstractCollection $content): void
{
$firstPosts = $content
->filter(function (Thread $thread): bool
{
return $thread->FirstPost !== null;
})
->pluckNamed('FirstPost', 'first_post_id');