• Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/connector/iblock.php
  • Класс: BitrixLandingConnectorIblock
  • Вызов: Iblock::getElementUrl
static function getElementUrl($siteId, $elementId): string
{
	$url = '';

	BitrixLandingRights::setGlobalOff();

	if (is_string($siteId))
	{
		$res = BitrixLandingSite::getList([
			'select' => ['ID'],
			'filter' => ['=TPL_CODE' => $siteId],
			'order' => ['ID' => 'desc']
		]);
		if ($row = $res->fetch())
		{
			$siteId = $row['ID'];
		}
	}

	$syspages = BitrixLandingSyspage::get($siteId);
	if (isset($syspages['catalog']))
	{
		$landing = BitrixLandingLanding::createInstance(
			$syspages['catalog']['LANDING_ID'],
			['skip_blocks' => true]
		);
		if ($landing->exist())
		{
			$url = BitrixLandingPublicActionUtils::getIblockURL(
				$elementId,
				'detail'
			);
			$url = str_replace(
				'#system_catalog',
				$landing->getPublicUrl(),
				$url
			);
			if (mb_substr($url, 0, 1) == '/')
			{
				$url = BitrixLandingSite::getPublicUrl(
					$landing->getSiteId()
				) . $url;
			}
		}
	}

	BitrixLandingRights::setGlobalOn();

	return $url;
}