• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/lib/CustomSection/Manager.php
  • Класс: BitrixIntranetCustomSectionManager
  • Вызов: Manager::prepareCustomSection
protected function prepareCustomSection(ResolveResult $result, Uri $url): ?string
{
	if (!preg_match(static::PAGE_URL_REGEX, $url->getPath(), $matches))
	{
		$result->addError(new Error(
			Loc::getMessage('INTRANET_CUSTOM_SECTION_MANAGER_INVALID_URL'),
			static::ERROR_CODE_INVALID_URL
		));
		return null;
	}

	$customSection = $this->getCustomSection((string)$matches['customSectionCode']);

	if (!$customSection)
	{
		$result->addError(new Error(
			Loc::getMessage('INTRANET_CUSTOM_SECTION_MANAGER_SECTION_NOT_FOUND'),
			static::ERROR_CODE_SECTION_NOT_FOUND
		));
		return null;
	}

	if (!$this->isCustomSectionAvailable($customSection))
	{
		$result->addError(new Error(
			Loc::getMessage('INTRANET_CUSTOM_SECTION_MANAGER_SECTION_NOT_AVAILABLE'),
			static::ERROR_CODE_SECTION_NOT_AVAILABLE
		));
		return null;
	}

	$result->setCustomSection($customSection);

	return (string)$matches['pageCode'];
}