• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/lib/component/element.php
  • Класс: BitrixIblockComponentElement
  • Вызов: Element::getSection
protected function getSection()
{
	$section = false;
	$sectionFilter = array(
		'IBLOCK_ID' => $this->arParams['IBLOCK_ID'],
		'ACTIVE' => 'Y',
	);

	if ($this->arParams['SECTION_ID'] > 0 || $this->arParams['SECTION_CODE'] !== '')
	{
		if ($this->arParams['SECTION_ID'] > 0)
		{
			$sectionFilter['ID'] = $this->arParams['SECTION_ID'];
		}
		else
		{
			$sectionFilter['HAS_ELEMENT'] = $this->arParams['ELEMENT_ID'];
			$sectionFilter['=CODE'] = $this->arParams['SECTION_CODE'];
		}

		$sectionIterator = CIBlockSection::GetList(array(), $sectionFilter);
		$sectionIterator->SetUrlTemplates('', $this->arParams['SECTION_URL']);
		$section = $sectionIterator->GetNext();
	}
	elseif ($this->arParams['CHECK_SECTION_ID_VARIABLE'] === 'Y' && $this->arParams['FROM_SECTION'] !== '')
	{
		if ((int)$this->arParams['FROM_SECTION'].'|' == $this->arParams['FROM_SECTION'].'|')
		{
			$sectionFilter['ID'] = $this->arParams['FROM_SECTION'];
		}
		else
		{
			$sectionFilter['HAS_ELEMENT'] = $this->arParams['ELEMENT_ID'];
			$sectionFilter['=CODE'] = $this->arParams['FROM_SECTION'];
		}

		$sectionIterator = CIBlockSection::GetList(array(), $sectionFilter);
		$sectionIterator->SetUrlTemplates('', $this->arParams['SECTION_URL']);
		$section = $sectionIterator->GetNext();
	}

	return $section;
}