@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 PhabricatorHomeProfileMenuEngine
4 extends PhabricatorProfileMenuEngine {
5
6 protected function isMenuEngineConfigurable() {
7 return true;
8 }
9
10 public function getItemURI($path) {
11 return "/home/menu/{$path}";
12 }
13
14 protected function buildItemViewContent(
15 PhabricatorProfileMenuItemConfiguration $item) {
16 $viewer = $this->getViewer();
17
18 // Add content to the document so that you can drag-and-drop files onto
19 // the home page or any home dashboard to upload them.
20
21 $upload = id(new PhabricatorGlobalUploadTargetView())
22 ->setViewer($viewer);
23
24 $content = parent::buildItemViewContent($item);
25
26 return array(
27 $content,
28 $upload,
29 );
30 }
31
32 /**
33 * Returns the menu items in the default home sidebar
34 *
35 * @return array<PhabricatorProfileMenuItemConfiguration>
36 */
37 protected function getBuiltinProfileItems($object) {
38 $viewer = $this->getViewer();
39 $items = array();
40 $custom_phid = $this->getCustomPHID();
41
42 $applications = id(new PhabricatorApplicationQuery())
43 ->setViewer($viewer)
44 ->withInstalled(true)
45 ->withUnlisted(false)
46 ->withLaunchable(true)
47 ->execute();
48
49 // Default Home Dashboard
50 $items[] = $this->newItem()
51 ->setBuiltinKey(PhabricatorHomeConstants::ITEM_HOME)
52 ->setMenuItemKey(PhabricatorHomeProfileMenuItem::MENUITEMKEY);
53
54 $items[] = $this->newItem()
55 ->setBuiltinKey(PhabricatorHomeConstants::ITEM_APPS_LABEL)
56 ->setMenuItemKey(PhabricatorLabelProfileMenuItem::MENUITEMKEY)
57 ->setMenuItemProperties(array('name' => pht('Favorites')));
58
59 foreach ($applications as $application) {
60 if (!$application->isPinnedByDefault($viewer)) {
61 continue;
62 }
63
64 $properties = array(
65 'name' => '',
66 'application' => $application->getPHID(),
67 );
68
69 $items[] = $this->newItem()
70 ->setBuiltinKey($application->getPHID())
71 ->setMenuItemKey(PhabricatorApplicationProfileMenuItem::MENUITEMKEY)
72 ->setMenuItemProperties($properties);
73 }
74
75 $items[] = $this->newItem()
76 ->setBuiltinKey(PhabricatorHomeConstants::ITEM_LAUNCHER)
77 ->setMenuItemKey(PhabricatorHomeLauncherProfileMenuItem::MENUITEMKEY);
78
79 $items[] = $this->newDividerItem('tail');
80
81 $items[] = $this->newManageItem();
82
83 return $items;
84 }
85
86}