• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/config/state.php
  • Класс: BitrixCatalogConfigState
  • Вызов: State::loadIblockSections
static function loadIblockSections(int $iblockId): void
{
	if (self::$iblockSections === null)
	{
		self::$iblockSections = [];
		self::$fullIblockSections = [];
		$sections = self::getLandingSections();
		if (!empty($sections))
		{
			$iterator = IblockSectionTable::getList([
				'select' => [
					'ID',
					'LEFT_MARGIN',
					'RIGHT_MARGIN',
				],
				'filter' => [
					'=IBLOCK_ID' => $iblockId,
					'@ID' => $sections,
				]
			]);
			while ($row = $iterator->fetch())
			{
				$row['ID'] = (int)$row['ID'];
				self::$iblockSections[] = $row['ID'];
				self::$fullIblockSections[$row['ID']] = $row['ID'];
				$sublist = IblockSectionTable::getList([
					'select' => ['ID'],
					'filter' => [
						'=IBLOCK_ID' => $iblockId,
						'>LEFT_MARGIN' => $row['LEFT_MARGIN'],
						' $row['RIGHT_MARGIN'],
					]
				]);
				while ($sub = $sublist->fetch())
				{
					$sub['ID'] = (int)$sub['ID'];
					self::$fullIblockSections[$sub['ID']] = $sub['ID'];
				}
			}
			unset($sub, $sublist, $row, $iterator);
		}
		unset($sections);
	}
}