• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/grid/row/assembler/morephotoassembler.php
  • Класс: BitrixCatalogGridRowAssemblerMorePhotoAssembler
  • Вызов: MorePhotoAssembler::prepareRows
public function prepareRows(array $rowList): array
{
	if (empty($this->getColumnIds()))
	{
		return $rowList;
	}

	$this->loadEntities($rowList);

	foreach ($rowList as &$row)
	{
		$id = (int)($row['data']['ID'] ?? 0);
		$type = $row['data']['ROW_TYPE'] ?? null;
		/**
		 * @var BaseProduct|BaseSku $entity
		 */
		$entity = $this->entities[$id] ?? null;

		$row['columns'] ??= [];

		foreach ($this->getColumnIds() as $columnId)
		{
			if ($id === 0 || $type !== RowType::ELEMENT || !isset($entity))
			{
				$row['data'][$columnId] = null;
				$row['columns'][$columnId] = null;
			}
			elseif ($this->getSettings()->isExcelMode())
			{
				$imagesSrc = [];
				foreach ($entity->getFrontImageCollection() as $image)
				{
					$uri = new Uri($image->getSource());
					$imagesSrc[] = (string)$uri->toAbsolute();
				}

				$row['data'][$columnId] = join(', ', $imagesSrc);
				$row['columns'][$columnId] = join(', ', $imagesSrc);
			}
			else
			{
				$imageInput = new ImageInput($entity);
				//$imageInput->disableAutoSaving();
				$html = $imageInput->getFormattedField();

				$row['data']['~' . $columnId] = $html['input'];
				$row['columns'][$columnId] = $html['preview'];
			}
		}
	}

	return $rowList;
}