Comment::fetchFileIds

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. Comment
  4. fetchFileIds
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/controller/timeline/comment.php
  • Класс: Bitrix\Crm\Controller\Timeline\Comment
  • Вызов: Comment::fetchFileIds
private function fetchFileIds(array $loadedFiles, ?int $authorId): array
{
	$filesList = [];

	if (
		count($loadedFiles) > 0
		&& Main\Config\Option::get('disk', 'successfully_converted', false)
		&& Main\Loader::includeModule('disk')
		&& ($storage = Driver::getInstance()->getStorageByUserId($authorId))
		&& ($folder = $storage->getFolderForUploadedFiles())
	)
	{
		foreach($loadedFiles as $tmp)
		{
			$fileFields = CRestUtil::saveFile($tmp);
			if (is_array($fileFields))
			{
				$file = $folder->uploadFile(
					$fileFields,
					[
						'NAME' => $fileFields['name'],
						'CREATED_BY' => $authorId
					],
					[],
					true
				);

				if ($file)
				{
					$filesList[] = FileUserType::NEW_FILE_PREFIX . $file->getId();
				}
			}
		}
	}

	return $filesList;
}

Добавить комментарий