diff options
author | Julius Härtl <jus@bitgrid.net> | 2019-01-24 12:03:52 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2019-03-01 20:56:18 +0100 |
commit | 3777df64ae0a4a3d79e000541c0c512fb3ebf304 (patch) | |
tree | 42b043e73f770a4b2fab422259c2969fa6d54a51 /apps/files/lib | |
parent | 506eb885bcaf7d745b417a155defc7c1e0f344c1 (diff) | |
download | nextcloud-server-3777df64ae0a4a3d79e000541c0c512fb3ebf304.tar.gz nextcloud-server-3777df64ae0a4a3d79e000541c0c512fb3ebf304.zip |
Add link to resource provider
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/files/lib')
-rw-r--r-- | apps/files/lib/Collaboration/Resources/ResourceProvider.php | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/apps/files/lib/Collaboration/Resources/ResourceProvider.php b/apps/files/lib/Collaboration/Resources/ResourceProvider.php index 4beb882ae3f..155dcbd7b14 100644 --- a/apps/files/lib/Collaboration/Resources/ResourceProvider.php +++ b/apps/files/lib/Collaboration/Resources/ResourceProvider.php @@ -27,6 +27,7 @@ use OCP\Collaboration\Resources\IResource; use OCP\Collaboration\Resources\ResourceException; use OCP\Files\IRootFolder; use OCP\Files\Node; +use OCP\IURLGenerator; use OCP\IUser; class ResourceProvider implements IProvider { @@ -36,11 +37,15 @@ class ResourceProvider implements IProvider { /** @var IRootFolder */ protected $rootFolder; + /** @var IURLGenerator */ + private $urlGenerator; + /** @var array */ protected $nodes = []; - public function __construct(IRootFolder $rootFolder) { + public function __construct(IRootFolder $rootFolder, IURLGenerator $urlGenerator) { $this->rootFolder = $rootFolder; + $this->urlGenerator = $urlGenerator; } /** @@ -102,4 +107,15 @@ class ResourceProvider implements IProvider { public function getType(): string { return self::RESOURCE_TYPE; } + + /** + * Get the link to a resource + * + * @param IResource $resource + * @return string + * @since 15.0.0 + */ + public function getLink(IResource $resource): string { + return $this->urlGenerator->linkToRoute('files.viewcontroller.showFile', ['fileid' => $resource->getId()]); + } } |