- Модуль: landing
- Путь к файлу: ~/bitrix/modules/landing/lib/note/source/taskcomment.php
- Класс: BitrixLandingNoteSourceTaskComment
- Вызов: TaskComment::getData
static function getData(int $sourceId): ?array
{
if (
BitrixMainLoader::includeModule('tasks') &&
BitrixMainLoader::includeModule('forum')
)
{
$res = MessageTable::getList([
'select' => [
'TOPIC_ID', 'POST_MESSAGE'
],
'filter' => [
'ID' => $sourceId,
'=APPROVED' => 'Y'
],
'limit' => 1
]);
if ($comment = $res->fetch())
{
[$tasks, ] = CTaskItem::fetchList(
BitrixLandingManager::getUserId(),
[],
['FORUM_TOPIC_ID' => $comment['TOPIC_ID']]
);
if ($tasks)
{
$params = [];
$taskData = $tasks[0]->getData();
$blocks = [[
'type' => 'header',
'content' => $taskData['TITLE']
]];
if (BitrixMainLoader::includeModule('disk'))
{
$params = [
'files' => self::getDiskFiles(
$sourceId,
BitrixDiskUfForumMessageConnector::class,
'forum'
)
];
}
$blocks = array_merge(
$blocks,
Parser::textToBlocks($comment['POST_MESSAGE'], $params)
);
return [
'TITLE' => truncateText($taskData['TITLE'], self::TITLE_LENGTH),
'BLOCKS' => $blocks
];
}
}
}
return null;
}