- Модуль: landing
- Путь к файлу: ~/bitrix/modules/landing/lib/note/source/blogcomment.php
- Класс: BitrixLandingNoteSourceBlogComment
- Вызов: BlogComment::getData
static function getData(int $sourceId): ?array
{
if (
BitrixMainLoader::includeModule('blog') &&
BitrixMainLoader::includeModule('socialnetwork')
)
{
$comment = CBlogComment::getByID($sourceId);
if (!$comment || $comment['PUBLISH_STATUS'] != BLOG_PUBLISH_STATUS_PUBLISH)
{
return null;
}
$post = CBlogPost::getByID($comment['POST_ID']);
if (BlogPost::canRead(['POST' => $post]))
{
$params = [];
$blocks = [[
'type' => 'header',
'content' => $post['TITLE']
]];
if (BitrixMainLoader::includeModule('disk'))
{
$params = [
'files' => self::getDiskFiles(
$sourceId,
BitrixDiskUfBlogPostCommentConnector::class,
'blog'
)
];
}
$blocks = array_merge(
$blocks,
Parser::textToBlocks($comment['POST_TEXT'], $params)
);
return [
'TITLE' => truncateText($post['TITLE'], self::TITLE_LENGTH),
'BLOCKS' => $blocks
];
}
}
return null;
}