@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 FundBackerListController
4 extends FundController {
5
6 private $initiative;
7
8 public function shouldAllowPublic() {
9 return true;
10 }
11
12 public function handleRequest(AphrontRequest $request) {
13 $viewer = $request->getViewer();
14 $id = $request->getURIData('id');
15 $querykey = $request->getURIData('queryKey');
16
17 if ($id) {
18 $this->initiative = id(new FundInitiativeQuery())
19 ->setViewer($viewer)
20 ->withIDs(array($id))
21 ->executeOne();
22 if (!$this->initiative) {
23 return new Aphront404Response();
24 }
25 }
26
27 $controller = id(new PhabricatorApplicationSearchController())
28 ->setQueryKey($querykey)
29 ->setSearchEngine($this->getEngine())
30 ->setNavigation($this->buildSideNavView());
31
32 return $this->delegateToController($controller);
33 }
34
35 public function buildSideNavView() {
36 $user = $this->getRequest()->getUser();
37
38 $nav = new AphrontSideNavFilterView();
39 $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
40
41 $this->getEngine()->addNavigationItems($nav->getMenu());
42
43 $nav->selectFilter(null);
44
45 return $nav;
46 }
47
48 protected function buildApplicationCrumbs() {
49 $crumbs = parent::buildApplicationCrumbs();
50 $crumbs->addTextCrumb(
51 pht('Backers'),
52 $this->getApplicationURI('backers/'));
53
54 if ($this->initiative) {
55 $crumbs->addTextCrumb(
56 $this->initiative->getMonogram(),
57 '/'.$this->initiative->getMonogram());
58 }
59
60 return $crumbs;
61 }
62
63 private function getEngine() {
64 $viewer = $this->getViewer();
65
66 $engine = id(new FundBackerSearchEngine())
67 ->setViewer($viewer);
68
69 if ($this->initiative) {
70 $engine->setInitiative($this->initiative);
71 }
72
73 return $engine;
74 }
75
76}