• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/lib/componenthelper.php
  • Класс: BitrixSocialnetworkComponentHelper
  • Вызов: ComponentHelper::getBlogCommentListCount
static function getBlogCommentListCount($postId)
{
	if (isset(self::$commentCountCache[$postId]))
	{
		$result = self::$commentCountCache[$postId];
	}
	else
	{
		if (!Loader::includeModule('blog'))
		{
			throw new MainSystemException("Could not load 'blog' module.");
		}

		$selectedFields = [ 'ID' ];

		$result = CBlogComment::getList(
			[ 'ID' => 'DESC' ],
			[
				"PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH,
				"POST_ID" => $postId,
			],
			[], // count only
			false,
			$selectedFields
		);

		self::$commentCountCache[$postId] = $result;
	}

	return $result;
}