• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/lib/livefeed/blogpost.php
  • Класс: BitrixSocialnetworkLivefeedBlogPost
  • Вызов: BlogPost::initSourceFields
public function initSourceFields()
{
	static $cache = [];

	$postId = $this->entityId;

	if ($postId <= 0)
	{
		return;
	}

	if (isset($cache[$postId]))
	{
		$post = $cache[$postId];
	}
	elseif (Loader::includeModule('blog'))
	{
		$res = self::$blogPostClass::getList(
			[],
			[
				'ID' => $postId
			]
		);

		$post = $res->fetch();
		$cache[$postId] = $post;
	}

	if (empty($post))
	{
		return;
	}

	$checkAccess = ($this->getOption('checkAccess') !== false);
	if (
		$checkAccess
		&& !self::canRead([
			'POST' => $post
		])
	)
	{
		return;
	}

	if (!empty($post['DETAIL_TEXT']))
	{
		$post['DETAIL_TEXT'] = Emoji::decode($post['DETAIL_TEXT']);
	}

	$this->setSourceFields($post);
	$this->setSourceDescription($post['DETAIL_TEXT']);
	$this->setSourceTitle(truncateText(($post['MICRO'] === 'N' ? $post['TITLE'] : htmlspecialcharsback($post['TITLE'])), 100));
	$this->setSourceAttachedDiskObjects($this->getAttachedDiskObjects($this->cloneDiskObjects));
	$this->setSourceDiskObjects($this->getDiskObjects($postId, $this->cloneDiskObjects));
}