• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integration/documentgenerator/productloader.php
  • Класс: Bitrix\Crm\Integration\DocumentGenerator\ProductLoader
  • Вызов: ProductLoader::getPreparedDirectoryImagePropertyValue
protected function getPreparedDirectoryImagePropertyValue($propertyId, int $elementId)
{
	$preparedPropertyCode = $propertyId . '_IMAGE';
	if (
		isset($this->preparedPropertyValues[$preparedPropertyCode])
		&& array_key_exists($elementId, $this->preparedPropertyValues[$preparedPropertyCode])
	)
	{
		return $this->preparedPropertyValues[$preparedPropertyCode][$elementId];
	}

	$property = $this->productProperties[$propertyId] ?? $this->offerProperties[$propertyId] ?? null;
	if (!$property)
	{
		return null;
	}

	$propertyValue = $this->getRawPropertyValue($property, $elementId);
	if (is_array($propertyValue))
	{
		$propertyValue = reset($propertyValue);
	}
	if (empty($propertyValue))
	{
		return null;
	}

	$directoryValue = $this->getPropertyDirectoryValue($property, $propertyValue);
	$fileId = (int)$directoryValue['FILE_ID'];

	if ($fileId > 0)
	{
		$this->preparedPropertyValues[$preparedPropertyCode][$elementId] = \CFile::GetPath($fileId);
	}
	else
	{
		$this->preparedPropertyValues[$preparedPropertyCode][$elementId] = null;
	}

	return $this->preparedPropertyValues[$preparedPropertyCode][$elementId];
}