@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorFileDocumentRenderingEngine
4 extends PhabricatorDocumentRenderingEngine {
5
6 protected function newRefViewURI(
7 PhabricatorDocumentRef $ref,
8 PhabricatorDocumentEngine $engine) {
9
10 $file = $ref->getFile();
11 $engine_key = $engine->getDocumentEngineKey();
12
13 return urisprintf(
14 '/file/view/%d/%s/',
15 $file->getID(),
16 $engine_key);
17 }
18
19 protected function newRefRenderURI(
20 PhabricatorDocumentRef $ref,
21 PhabricatorDocumentEngine $engine) {
22 $file = $ref->getFile();
23 if (!$file) {
24 throw new PhutilMethodNotImplementedException();
25 }
26
27 $engine_key = $engine->getDocumentEngineKey();
28 $file_phid = $file->getPHID();
29
30 return urisprintf(
31 '/file/document/%s/%s/',
32 $engine_key,
33 $file_phid);
34 }
35
36 protected function addApplicationCrumbs(
37 PHUICrumbsView $crumbs,
38 ?PhabricatorDocumentRef $ref = null) {
39
40 if ($ref) {
41 $file = $ref->getFile();
42 if ($file) {
43 $crumbs->addTextCrumb($file->getMonogram(), $file->getInfoURI());
44 }
45 }
46
47 }
48
49}