- Модуль: socialnetwork
- Путь к файлу: ~/bitrix/modules/socialnetwork/lib/componenthelper.php
- Класс: BitrixSocialnetworkComponentHelper
- Вызов: ComponentHelper::getLiveCommentRecords
static function getLiveCommentRecords(array $params = []): array
{
$commentId = (int)($params['commentId'] ?? 0);
$ratingTypeId = (string)($params['ratingTypeId'] ?? '');
$timestamp = (int)($params['timestamp'] ?? 0);
$author = (array)($params['author'] ?? []);
$uf = (array)($params['uf'] ?? []);
$ufFormatted = (string)($params['ufFormatted'] ?? '');
$postMessageTextOriginal = (string)($params['postMessageTextOriginal'] ?? '');
$postMessageTextFormatted = (string)($params['postMessageTextFormatted'] ?? '');
$mobileMessage = (string)($params['mobileMessage'] ?? '');
$aux = (string)($params['aux'] ?? '');
$auxLiveParams = (array)($params['auxLiveParams'] ?? []);
$records = [
$commentId => [
'ID' => $commentId,
'RATING_VOTE_ID' => $ratingTypeId . '_' . $commentId . '-' . (time() + random_int(0, 1000)),
'APPROVED' => 'Y',
'POST_TIMESTAMP' => $timestamp,
'AUTHOR' => $author,
'FILES' => false,
'UF' => $uf,
'~POST_MESSAGE_TEXT' => $postMessageTextOriginal,
'WEB' => [
'CLASSNAME' => '',
'POST_MESSAGE_TEXT' => $postMessageTextFormatted,
'AFTER' => $ufFormatted,
],
'MOBILE' => [
'CLASSNAME' => '',
'POST_MESSAGE_TEXT' => $mobileMessage
],
'AUX' => $aux,
'AUX_LIVE_PARAMS' => $auxLiveParams,
]
];
if (
!empty($uf)
&& !empty($uf['UF_SONET_COM_DOC'])
&& !empty($uf['UF_SONET_COM_DOC']['VALUE'])
)
{
$inlineDiskAttachedObjectIdImageList = self::getInlineDiskImages([
'text' => $postMessageTextOriginal,
'commentId' => $commentId,
]);
if (!empty($inlineDiskAttachedObjectIdImageList))
{
$records[$commentId]['WEB']['UF'] = $records[$commentId]['UF'];
$records[$commentId]['MOBILE']['UF'] = $records[$commentId]['UF'];
$records[$commentId]['MOBILE']['UF']['UF_SONET_COM_DOC']['VALUE'] = array_diff($records[$commentId]['MOBILE']['UF']['UF_SONET_COM_DOC']['VALUE'], $inlineDiskAttachedObjectIdImageList);
}
}
return $records;
}