@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
3abstract class DrydockResourceController
4 extends DrydockController {
5
6 private $blueprint;
7
8 public function setBlueprint($blueprint) {
9 $this->blueprint = $blueprint;
10 return $this;
11 }
12
13 public function getBlueprint() {
14 return $this->blueprint;
15 }
16
17 public function buildSideNavView() {
18 $nav = new AphrontSideNavFilterView();
19 $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
20
21 $engine = id(new DrydockResourceSearchEngine())
22 ->setViewer($this->getViewer());
23
24 if ($this->getBlueprint()) {
25 $engine->setBlueprint($this->getBlueprint());
26 }
27
28 $engine->addNavigationItems($nav->getMenu());
29
30 $nav->selectFilter(null);
31
32 return $nav;
33 }
34
35 protected function buildApplicationCrumbs() {
36 $crumbs = parent::buildApplicationCrumbs();
37
38 $blueprint = $this->getBlueprint();
39 if ($blueprint) {
40 $id = $blueprint->getID();
41 $crumbs->addTextCrumb(
42 pht('Blueprints'),
43 $this->getApplicationURI('blueprint/'));
44
45 $crumbs->addTextCrumb(
46 $blueprint->getBlueprintName(),
47 $this->getApplicationURI("blueprint/{$id}/"));
48
49 $crumbs->addTextCrumb(
50 pht('Resources'),
51 $this->getApplicationURI("blueprint/{$id}/resources/"));
52 } else {
53 $crumbs->addTextCrumb(
54 pht('Resources'),
55 $this->getApplicationURI('resource/'));
56 }
57 return $crumbs;
58 }
59
60}