• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/classes/general/prop_element_auto.php
  • Класс: CIBlockPropertyElementAutoComplete
  • Вызов: CIBlockPropertyElementAutoComplete::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 ($iblockId > 0)
			$arFilter['IBLOCK_ID'] = $iblockId;
		$arFilter['ID'] = $elementId;
		$arFilter['SHOW_HISTORY'] = 'Y';
		$rsElements = CIBlockElement::GetList([], $arFilter, false, false, ['IBLOCK_ID','ID','NAME']);
		if ($arElement = $rsElements->GetNext())
		{
			$arResult = array(
				'ID' => $arElement['ID'],
				'NAME' => $arElement['NAME'],
				'~NAME' => $arElement['~NAME'],
				'IBLOCK_ID' => $arElement['IBLOCK_ID'],
			);
			$cache[$elementId] = $arResult;
		}
		else
		{
			$cache[$elementId] = false;
		}
	}

	return $cache[$elementId];
}