@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 PhabricatorMacroController extends PhabricatorController {
4
5 protected function buildSideNavView($for_app = false) {
6 $nav = new AphrontSideNavFilterView();
7 $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
8
9 if ($for_app) {
10 $nav->addLabel(pht('Create'));
11 $nav->addFilter('',
12 pht('Create Macro'),
13 $this->getApplicationURI('/create/'));
14 }
15
16 id(new PhabricatorMacroSearchEngine())
17 ->setViewer($this->getRequest()->getUser())
18 ->addNavigationItems($nav->getMenu());
19
20 return $nav;
21 }
22
23 public function buildApplicationMenu() {
24 return $this->buildSideNavView($for_app = true)->getMenu();
25 }
26
27 protected function buildApplicationCrumbs() {
28 $crumbs = parent::buildApplicationCrumbs();
29
30 $can_manage = $this->hasApplicationCapability(
31 PhabricatorMacroManageCapability::CAPABILITY);
32
33 $crumbs->addAction(
34 id(new PHUIListItemView())
35 ->setName(pht('Create Macro'))
36 ->setHref($this->getApplicationURI('/create/'))
37 ->setIcon('fa-plus-square')
38 ->setDisabled(!$can_manage)
39 ->setWorkflow(!$can_manage));
40
41 return $crumbs;
42 }
43
44}