• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/comments/task/commentposter.php
  • Класс: BitrixTasksCommentsTaskCommentPoster
  • Вызов: CommentPoster::postComments
public function postComments(): void
{
	foreach ($this->comments as $comment)
	{
		$auxData = $comment->getData();

		$hasLiveData = false;
		if (is_array($auxData))
		{
			foreach ($auxData as $value)
			{
				if (!is_array($value))
				{
					continue;
				}

				foreach ($value as $commentData)
				{
					if (
						!is_array($commentData)
						|| !is_array($commentData[1])
						|| empty($commentData[1]['LIVE_DATA'])
						|| !is_array($commentData[1]['LIVE_DATA'])
					)
					{
						continue;
					}

					$hasLiveData = true;
					break;
				}

				if ($hasLiveData)
				{
					break;
				}
			}
		}

		/** @var Comment $comment */
		ForumTaskComment::add($this->taskId, [
			'AUTHOR_ID' => $comment->getAuthorId(),
			'POST_MESSAGE' => $comment->getText(),
			'UF_TASK_COMMENT_TYPE' => $comment->getType(),
			'AUX' => 'Y',
			'AUX_DATA' => $auxData,
			'AUX_LIVE_PARAMS' => ($hasLiveData ? [ 'JSON' => MainWebJson::encode($auxData) ] : []),
		]);
	}
}