File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
apps/workflowengine/lib/Entity Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 2626
2727use OCP \EventDispatcher \Event ;
2828use OCP \EventDispatcher \GenericEvent ;
29+ use OCP \Files \InvalidPathException ;
2930use OCP \Files \IRootFolder ;
3031use OCP \Files \Node ;
3132use OCP \Files \NotFoundException ;
3839use OCP \SystemTag \ISystemTagManager ;
3940use OCP \SystemTag \MapperEvent ;
4041use OCP \WorkflowEngine \EntityContext \IDisplayText ;
42+ use OCP \WorkflowEngine \EntityContext \IUrl ;
4143use OCP \WorkflowEngine \GenericEntityEvent ;
4244use OCP \WorkflowEngine \IEntity ;
4345use OCP \WorkflowEngine \IRuleMatcher ;
4446
45- class File implements IEntity, IDisplayText {
47+ class File implements IEntity, IDisplayText, IUrl {
4648
4749 private const EVENT_NAMESPACE = '\OCP\Files:: ' ;
4850
@@ -208,4 +210,14 @@ public function getDisplayText(int $verbosity = 0): string {
208210 return $ this ->l10n ->t ('%s assigned %s to %s ' , $ options );
209211 }
210212 }
213+
214+ public function getUrl (): string {
215+ try {
216+ return $ this ->urlGenerator ->linkToRouteAbsolute ('files.viewcontroller.showFile ' , ['fileid ' => $ this ->getNode ()->getId ()]);
217+ } catch (InvalidPathException $ e ) {
218+ return '' ;
219+ } catch (NotFoundException $ e ) {
220+ return '' ;
221+ }
222+ }
211223}
You can’t perform that action at this time.
0 commit comments