• Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/landing/urlpreview.php
  • Класс: BitrixLandingLandingUrlPreview
  • Вызов: UrlPreview::getImRich
static function getImRich(array $params)
{
	if (!Loader::includeModule('im'))
	{
		return false;
	}

	if (!class_exists('BitrixImV2EntityUrlRichData'))
	{
		return false;
	}

	if (isset($params['scope']))
	{
		BitrixLandingSiteType::setScope(
			$params['scope']
		);
	}

	if (!isset($params['URL']))
	{
		$params['URL'] = Manager::getPublicationPath() . ($params['knowledgeCode'] ?? '');
	}

	$landingId = self::resolveLandingId($params['URL']);

	if ($landingId)
	{
		$preview = self::getPreview($landingId);
		if ($preview)
		{
			$rich = new BitrixImV2EntityUrlRichData();
			$rich
				->setName($preview['TITLE'])
				->setDescription($preview['DESCRIPTION'])
				->setLink($preview['URL'])
				->setPreviewUrl($preview['PICTURE'])
				->setType(BitrixImV2EntityUrlRichData::LANDING_TYPE)
			;
			return $rich;
		}
	}

	return false;
}