function getEntityReferences($userfield, \Bitrix\Main\Entity\ScalarField $entityField) { if ($userfield['SETTINGS']['HLBLOCK_ID']) { $hlblock = \Bitrix\Highloadblock\HighloadBlockTable::getById($userfield['SETTINGS']['HLBLOCK_ID'])->fetch(); if ($hlblock) { $hlentity = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($hlblock); return array(new \Bitrix\Main\Entity\ReferenceField($entityField->getName() . '_REF', $hlentity, array('=this.' . $entityField->getName() => 'ref.ID'))); } } return array(); }