• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Service/Display/Field/CrmField.php
  • Класс: Bitrix\Crm\Service\Display\Field\CrmField
  • Вызов: CrmField::prepareLinkedEntities
public function prepareLinkedEntities(
	array &$linkedEntities,
	$fieldValue,
	int $itemId,
	string $fieldId
): void
{
	$this->entityTypes = $this->getEntityTypes();
	$fieldType = $this->getType();
	foreach ((array)$fieldValue as $value)
	{
		if ($this->needExplodeValue($value))
		{
			$valueParts = explode('_', $value);
			if (count($valueParts) === 2)
			{
				$entityType = ElementType::getLongEntityType($valueParts[0]);
				$entityId = (int)$valueParts[1];
			}
			else
			{
				$entityType = '';
				$entityId = 0;
			}
		}
		else
		{
			$entityType = $this->entityTypes[0];
			$entityId = (int)$value;
		}

		if ($entityId > 0)
		{
			$linkedEntities[$fieldType][$entityType][] = $entityId;
			$linkedEntities[$fieldType]['FIELD'][$itemId][$fieldId][$entityType][$entityId] = $entityId;
		}
	}
}