mirror of
https://github.com/nextcloud/server.git
synced 2026-11-20 11:30:26 +01:00
37 lines
948 B
PHP
37 lines
948 B
PHP
<?php
|
|
|
|
/*
|
|
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace OCA\Files\Sharing\Source;
|
|
|
|
use NCU\Sharing\Icon\ShareIconURL;
|
|
use NCU\Sharing\Source\IShareSourceMetadata;
|
|
use OCP\Files\Cache\ICacheEntry;
|
|
use OCP\IURLGenerator;
|
|
|
|
final readonly class NodeShareSourceMetadata implements IShareSourceMetadata {
|
|
public function __construct(
|
|
private IURLGenerator $urlGenerator,
|
|
private ICacheEntry $cacheEntry,
|
|
) {
|
|
}
|
|
|
|
#[\Override]
|
|
public function getDisplayName(): string {
|
|
$name = $this->cacheEntry->getName();
|
|
return $name !== '' ? $name: (string)$this->cacheEntry->getId();
|
|
}
|
|
|
|
#[\Override]
|
|
public function getIcon(): ShareIconURL {
|
|
$url = $this->urlGenerator->linkToRouteAbsolute('core.Preview.getPreviewByFileId', ['fileId' => $this->cacheEntry->getId(), 'x' => 64, 'y' => 64]);
|
|
|
|
return new ShareIconURL($url, $url);
|
|
}
|
|
}
|