• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/controller/timeline/comment.php
  • Класс: Bitrix\Crm\Controller\Timeline\Comment
  • Вызов: Comment::loadAction
public function loadAction(int $commentId, int $ownerTypeId, int $ownerId, int $options = 0): ?array
{
	if ($this->getScope() !== static::SCOPE_AJAX)
	{
		$this->addError(ErrorCode::getAccessDeniedError());

		return null;
	}

	if (!$this->assertValidCommentRecord($commentId))
	{
		return null;
	}

	if (!$this->assertValidOwner($ownerId, $ownerTypeId, false))
	{
		return null;
	}

	$html = '';

	if ($options & self::LOAD_FILES_BLOCK)
	{
		$html = CommentController::getFileBlock($commentId);
	}

	if ($options & self::LOAD_TEXT_CONTENT)
	{
		$commentData = $this->load($commentId);
		$result = CommentController::convertToHtml(
			[
				'ID' => $commentData->getId(),
				'CREATED' => $commentData->getCreated(),
				'AUTHOR_ID' => $commentData->getAuthorId(),
				'COMMENT' => $commentData->getComment(),
				'SETTINGS' => $commentData->getSettings(),
			],
			['INCLUDE_FILES' => 'Y']
		);
		$html = $result['COMMENT'];
	}

	return [
		'commentId' => $commentId,
		'html' => $html,
	];
}