• Модуль: salescenter
  • Путь к файлу: ~/bitrix/modules/salescenter/lib/controller/order.php
  • Класс: BitrixSalesCenterControllerOrder
  • Вызов: Order::getFileControl
public function getFileControl($elementId = null): string
{
	$productImagePropertyDescription = $this->getProductImagePropertyDescription($elementId);
	$property = $productImagePropertyDescription['description'];
	$value = $productImagePropertyDescription['values'];

	$inputName = $this->getFilePropertyInputName($property);

	if ($value && !is_array($value))
	{
		$value = [$value];
	}

	$fileValues = [];

	if (!empty($value) && is_array($value))
	{
		foreach ($value as $fileId)
		{
			$propName = str_replace('n#IND#', $fileId, $inputName);
			$fileValues[$propName] = $fileId;
		}
	}

	$fileType = $property['settings']['FILE_TYPE'] ?? null;

	$fileParams = [
		'name' => $inputName,
		'id' => $inputName.'_'.random_int(1, 1000000),
		'description' => $property['settings']['WITH_DESCRIPTION'] ?? 'Y',
		'allowUpload' => $fileType ? 'F' : 'I',
		'allowUploadExt' => $fileType,
		'maxCount' => ($property['settings']['MULTIPLE'] ?? 'N') !== 'Y' ? 1 : null,
		'upload' => true,
		'medialib' => false,
		'fileDialog' => true,
		'cloud' => true,
	];

	return $this->getFileControlComponentContent([
		'FILE_SETTINGS' => $fileParams,
		'FILE_VALUES' => $fileValues,
		'LOADER_PREVIEW' => $this->getFilePropertyViewHtml($value),
	]);
}