• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/integration/disk.php
  • Класс: BitrixTasksIntegrationDisk
  • Вызов: Disk::getAttachmentData
static function getAttachmentData(array $valueList): array
{
	$result = [];

	if (!static::includeModule())
	{
		return $result;
	}

	$driver = Driver::getInstance();
	$urlManager = $driver->getUrlManager();

	foreach ($valueList as $value)
	{
		$attachedObject = AttachedObject::loadById($value, ['OBJECT']);
		if (!$attachedObject || !($file = $attachedObject->getFile()))
		{
			continue;
		}

		$result[$value] = [
			'ID' => $value,
			'OBJECT_ID' => $file->getId(),
			'NAME' => $file->getName(),
			'SIZE' => CFile::formatSize($file->getSize()),
			'URL' => $urlManager::getUrlUfController('show', ['attachedId' => $value]),
			'TYPE' => TypeFile::getMimeTypeByFilename($file->getName()),
			'IS_IMAGE' => TypeFile::isImage($file),
		];
	}

	return $result;
}