• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/lib/CustomSection/Manager.php
  • Класс: BitrixIntranetCustomSectionManager
  • Вызов: Manager::preparePages
protected function preparePages(ResolveResult $result, string $pageCode): void
{
	$customSection = $result->getCustomSection();
	if (is_null($customSection))
	{
		throw new ObjectNotFoundException('Custom section is required for further operations');
	}

	$availablePages = $this->getAvailablePages($customSection);
	if (empty($availablePages))
	{
		throw new InvalidOperationException('Custom section has no available pages');
	}

	$this->fillCountersInfo($availablePages);

	$activePage = null;
	foreach ($availablePages as $page)
	{
		if ($page->getCode() === $pageCode)
		{
			$activePage = $page;
		}
	}

	if (is_null($activePage))
	{
		$activePage = $this->getLastOpenedPage($customSection->getCode(), $availablePages);
	}
	if (is_null($activePage))
	{
		$activePage = $this->getPageWithMinSort($availablePages);
	}

	$result->setAvailablePages($availablePages);
	$result->setActivePage($activePage);

	if ($activePage->getCode() !== $this->getLastOpenedPageCode($customSection->getCode()))
	{
		$this->setLastOpenedPageCode($customSection->getCode(), $activePage->getCode());
	}
}