Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / almanac / controller / AlmanacNetworkListController.php
blob9635f51e6e662779ea6000c8c489427b12fa18f0
1 <?php
3 final class AlmanacNetworkListController
4 extends AlmanacNetworkController {
6 public function shouldAllowPublic() {
7 return true;
10 public function handleRequest(AphrontRequest $request) {
11 $controller = id(new PhabricatorApplicationSearchController())
12 ->setQueryKey($request->getURIData('queryKey'))
13 ->setSearchEngine(new AlmanacNetworkSearchEngine())
14 ->setNavigation($this->buildSideNavView());
16 return $this->delegateToController($controller);
19 protected function buildApplicationCrumbs() {
20 $crumbs = parent::buildApplicationCrumbs();
22 $can_create = $this->hasApplicationCapability(
23 AlmanacCreateNetworksCapability::CAPABILITY);
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));
33 return $crumbs;
36 public function buildSideNavView() {
37 $viewer = $this->getViewer();
39 $nav = new AphrontSideNavFilterView();
40 $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
42 id(new AlmanacNetworkSearchEngine())
43 ->setViewer($viewer)
44 ->addNavigationItems($nav->getMenu());
46 $nav->selectFilter(null);
48 return $nav;