• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/classes/general/prop_section_auto.php
  • Класс: CIBlockPropertySectionAutoComplete
  • Вызов: CIBlockPropertySectionAutoComplete::GetLinkElement
static function GetLinkElement($elementId, $iblockId)
{
	static $cache = [];

	$iblockId = (int)$iblockId;
	if ($iblockId <= 0)
		$iblockId = 0;
	$elementId = (int)$elementId;
	if ($elementId <= 0)
		return false;
	if (!isset($cache[$elementId]))
	{
		$arFilter = [];
		if (0 < $iblockId)
			$arFilter['IBLOCK_ID'] = $iblockId;
		$arFilter['ID'] = $elementId;
		$sectionRes = CIBlockSection::GetList([], $arFilter, false, ['IBLOCK_ID','ID','NAME']);
		if ($section = $sectionRes->GetNext(true,true))
		{
			$result = [
				'ID' => $section['ID'],
				'NAME' => $section['NAME'],
				'~NAME' => $section['~NAME'],
				'IBLOCK_ID' => $section['IBLOCK_ID'],
			];
			$cache[$elementId] = $result;
		}
		else
		{
			$cache[$elementId] = false;
		}
	}

	return $cache[$elementId];
}