14 private int $iblockId;
19 $this->iblockId = $iblockId;
22 $this->getPropertyColumnsIds()
26 private function getPropertyColumnsIds(): array
35 '=IBLOCK_ID' => $this->iblockId,
40 foreach ($rows as $row)
42 $result[] = ElementPropertyProvider::getColumnIdByPropertyId((
int)$row[
'ID']);
56 foreach ($rowList as $row)
60 $value = $row[
'data'][$columnId] ??
null;
63 foreach ($value as $valueItem)
65 $fileIds[] = (int)$valueItem;
68 elseif (isset($value))
70 $fileIds[] = (int)$value;
80 $this->preloadFiles($fileIds);
82 return parent::prepareRows($rowList);
87 $row[
'columns'] ??= [];
91 $value = $row[
'data'][$columnId] ??
null;
92 if ($value !==
null || is_array($value))
95 $row[
'data'][
'~' . $columnId] ??= $this->getDataForEdit($value);
98 $row[
'columns'][$columnId] ??= $this->getImageHtml($columnId, $value);
113 private function getImageHtml(
string $columnId, $value): string
115 if (Loader::includeModule(
'fileman'))
117 return CFileInput::Show(
122 'IMAGE_POPUP' =>
'N',
138 'file_dialog' =>
false,
141 'description' =>
false,
156 $APPLICATION->IncludeComponent(
'bitrix:main.file.input',
'', [
157 'MODULE_ID' =>
'catalog',
159 'ALLOW_UPLOAD' =>
'N',
160 'INPUT_NAME' => $columnId,
161 'INPUT_VALUE' => $value,
164 return ob_get_contents();
172 private function getFileSrc(
int $fileId): ?string
174 $file = $this->files[$fileId] ??
null;
177 return CFile::GetFileSRC($file);
183 private function getDataForEdit($value)
185 if (is_array($value))
189 foreach ($value as $valueItem)
191 $result[] = $this->getFileSrc((
int)$valueItem);
196 elseif (isset($value))
198 return $this->getFileSrc((
int)$value);
204 private function preloadFiles(array $fileIds): void
213 $rows = CFile::GetList([], [
216 while ($row = $rows->Fetch())
218 $this->files[$row[
'ID']] = $row;
static getList(array $parameters=array())