• Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/landing/urlpreview.php
  • Класс: BitrixLandingLandingUrlPreview
  • Вызов: UrlPreview::getImAttach
static function getImAttach(array $params)
{
	if (!Loader::includeModule('im'))
	{
		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)
		{
			$attach = new CIMMessageParamAttach(1, '#E30000');
			$attach->addLink([
				'NAME' => $preview['TITLE'],
				'DESC' => $preview['DESCRIPTION'],
				'LINK' => $preview['URL'],
				'PREVIEW' => $preview['PICTURE']
			]);
			return $attach;
		}
	}

	return false;
}