@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 AlmanacNetworkListController
4 extends AlmanacNetworkController {
5
6 public function shouldAllowPublic() {
7 return true;
8 }
9
10 public function handleRequest(AphrontRequest $request) {
11 $controller = id(new PhabricatorApplicationSearchController())
12 ->setQueryKey($request->getURIData('queryKey'))
13 ->setSearchEngine(new AlmanacNetworkSearchEngine())
14 ->setNavigation($this->buildSideNavView());
15
16 return $this->delegateToController($controller);
17 }
18
19 protected function buildApplicationCrumbs() {
20 $crumbs = parent::buildApplicationCrumbs();
21
22 $can_create = $this->hasApplicationCapability(
23 AlmanacCreateNetworksCapability::CAPABILITY);
24
25 $crumbs->addAction(
26 id(new PHUIListItemView())
27 ->setName(pht('Create Network'))
28 ->setHref($this->getApplicationURI('network/edit/'))
29 ->setIcon('fa-plus-square')
30 ->setDisabled(!$can_create)
31 ->setWorkflow(!$can_create));
32
33 return $crumbs;
34 }
35
36 public function buildSideNavView() {
37 $viewer = $this->getViewer();
38
39 $nav = new AphrontSideNavFilterView();
40 $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
41
42 id(new AlmanacNetworkSearchEngine())
43 ->setViewer($viewer)
44 ->addNavigationItems($nav->getMenu());
45
46 $nav->selectFilter(null);
47
48 return $nav;
49 }
50
51
52}