• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/v2/Integration/UI/EntitySelector/IblockElementProvider.php
  • Класс: BitrixCatalogv2IntegrationUIEntitySelectorIblockElementProvider
  • Вызов: IblockElementProvider::getElementImage
private function getElementImage(array $element): ?string
{
	$iblockId = $element['IBLOCK_ID'] ?? null;
	if (!$iblockId)
	{
		return '';
	}

	$photoPropertyId = $this->getMorePhotoPropertyId($iblockId);
	if (!$photoPropertyId)
	{
		return '';
	}

	$propertyFilter = [
		'ID' => $photoPropertyId,
	];
	$result = CIBlockElement::GetProperty($iblockId, $element['ID'], 'sort', 'asc', $propertyFilter)->Fetch();

	if (empty($result['VALUE']))
	{
		return '';
	}

	if (is_array($result['VALUE']))
	{
		$imageId = (int)$result['VALUE'][0];
	}
	else
	{
		$imageId = (int)$result['VALUE'];
	}

	return $this->getImageSource($imageId);
}