• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/v2/Image/ImageRepository.php
  • Класс: BitrixCatalogv2ImageImageRepository
  • Вызов: ImageRepository::getMorePhotoEntities
private function getMorePhotoEntities(BaseIblockElementEntity $element): array
{
	$morePhotos = [];
	$property = $element->getPropertyCollection()->findByCode(MorePhotoImage::CODE);
	if (!$property)
	{
		return [];
	}

	$morePhotoValueCollection = $property->getPropertyValueCollection();
	$morePhotoIds = $morePhotoValueCollection->getValues();
	if (empty($morePhotoIds))
	{
		return [];
	}
	$fields = $this->getList([
		'filter' => [
			'=ID' => $morePhotoIds,
		],
	]);
	if (empty($fields))
	{
		return [];
	}


	$fields = array_combine(array_column($fields, 'ID'), $fields);
	/** @var BitrixCatalogv2PropertyValuePropertyValue $value */
	foreach ($morePhotoValueCollection as $value)
	{
		$fileId = (int)$value->getValue();
		if ($fileId > 0 && isset($fields[$fileId]))
		{
			$fileFields = $fields[$fileId];
			if (empty($fileFields))
			{
				continue;
			}
			$fileFields['PROPERTY_VALUE_ID'] = $value->getId();
			$morePhotos[] = $this->createEntity($fileFields);
		}
	}

	return $morePhotos;
}