- Модуль: salescenter
- Путь к файлу: ~/bitrix/modules/salescenter/lib/integration/landingmanager.php
- Класс: BitrixSalesCenterIntegrationLandingManager
- Вызов: LandingManager::getPublicUrlInfo
protected function getPublicUrlInfo(string $code, array $urlParameters = []): ?array
{
if (!isset($this->landingPublicUrlInfo[$code]))
{
if (!$this->isSiteExists())
{
$this->tryInstallDefaultSiteOnce();
}
if ($this->isEnabled && $this->isSiteExists())
{
LandingRights::setOff();
$siteId = $this->getConnectedSiteId();
$sysPages = LandingSyspage::get($siteId, true);
// try to update to add new pages if needed
if (!isset($sysPages[$code]))
{
LandingSiteVersion::update(
$siteId,
LandingSite::getVersion($siteId)
);
$sysPages = LandingSyspage::get($siteId, true, true);
}
if (isset($sysPages[$code]))
{
$landingId = (int)$sysPages[$code]['LANDING_ID'];
$landing = LandingLanding::createInstance($landingId);
if ($landing->exist())
{
$this->landingPublicUrlInfo[$code] = [
'url' => $landing->getPublicUrl(false, true),
'title' => $landing->getTitle(),
'landingId' => $landingId,
'isActive' => ($landing->isActive() && $this->isSitePublished()),
];
}
}
LandingRights::setOn();
}
}
if (!isset($this->landingPublicUrlInfo[$code]))
{
return null;
}
$publicUrlInfo = $this->landingPublicUrlInfo[$code];
if (is_array($publicUrlInfo) && !empty($urlParameters))
{
$uri = new Uri($publicUrlInfo['url']);
$uri->addParams($urlParameters);
$publicUrlInfo['url'] = $uri->getLocator();
}
$publicUrlInfo['shortUrl'] =
UrlManager::getInstance()->getHostUrl() . CBXShortUri::GetShortUri($publicUrlInfo['url']);
return $publicUrlInfo;
}