• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Service/Timeline/Item/Comment.php
  • Класс: Bitrix\Crm\Service\Timeline\Item\Comment
  • Вызов: Comment::buildContentBlock
private function buildContentBlock(string $scope = ContentBlock::SCOPE_WEB): CommentContent
{
	$hasFiles = $this->getHistoryItemModel()->get('HAS_FILES') === 'Y';

	$block = (new CommentContent())
		->setHeight(ContentBlock\EditableDescription::HEIGHT_LONG)
		->setAction(
			(new RunAjaxAction('crm.timeline.comment.update'))
				->addActionParamInt('ownerTypeId', $this->getContext()->getIdentifier()->getEntityTypeId())
				->addActionParamInt('ownerId', $this->getContext()->getIdentifier()->getEntityId())
				->addActionParamInt('commentId', $this->getModel()->getId())
		)
		->setLoadAction(
			(new RunAjaxAction('crm.timeline.comment.load'))
				->addActionParamInt('ownerTypeId', $this->getContext()->getIdentifier()->getEntityTypeId())
				->addActionParamInt('ownerId', $this->getContext()->getIdentifier()->getEntityId())
				->addActionParamInt('commentId', $this->getModel()->getId())
		)
		->setFilesCount($hasFiles ? count($this->getUserFieldFiles()) : 0)
		->setHasInlineFiles($this->getHistoryItemModel()->get('HAS_INLINE_ATTACHMENT') === 'Y')
	;

	$data = TimelineEntry::getByID($this->getModel()->getId()) ?? [];

	if ($scope === ContentBlock::SCOPE_MOBILE)
	{
		$comment = $data['COMMENT'] ?? '';
		$content = TextHelper::sanitizeBbCode($comment);
		$block->setScopeMobile();
	}
	else
	{
		$content = CommentController::convertToHtml($data)['COMMENT'] ?? '';
		$content = htmlspecialcharsbx($content);
		$block->setScopeWeb();
	}

	return $block->setText($content);
}