Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/home/engine/PhabricatorHomeProfileMenuEngine.php
12256 views
1
<?php
2
3
final 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
->setUser($viewer);
23
24
$content = parent::buildItemViewContent($item);
25
26
return array(
27
$content,
28
$upload,
29
);
30
}
31
32
protected function getBuiltinProfileItems($object) {
33
$viewer = $this->getViewer();
34
$items = array();
35
$custom_phid = $this->getCustomPHID();
36
37
$applications = id(new PhabricatorApplicationQuery())
38
->setViewer($viewer)
39
->withInstalled(true)
40
->withUnlisted(false)
41
->withLaunchable(true)
42
->execute();
43
44
// Default Home Dashboard
45
$items[] = $this->newItem()
46
->setBuiltinKey(PhabricatorHomeConstants::ITEM_HOME)
47
->setMenuItemKey(PhabricatorHomeProfileMenuItem::MENUITEMKEY);
48
49
$items[] = $this->newItem()
50
->setBuiltinKey(PhabricatorHomeConstants::ITEM_APPS_LABEL)
51
->setMenuItemKey(PhabricatorLabelProfileMenuItem::MENUITEMKEY)
52
->setMenuItemProperties(array('name' => pht('Favorites')));
53
54
foreach ($applications as $application) {
55
if (!$application->isPinnedByDefault($viewer)) {
56
continue;
57
}
58
59
$properties = array(
60
'name' => '',
61
'application' => $application->getPHID(),
62
);
63
64
$items[] = $this->newItem()
65
->setBuiltinKey($application->getPHID())
66
->setMenuItemKey(PhabricatorApplicationProfileMenuItem::MENUITEMKEY)
67
->setMenuItemProperties($properties);
68
}
69
70
$items[] = $this->newItem()
71
->setBuiltinKey(PhabricatorHomeConstants::ITEM_LAUNCHER)
72
->setMenuItemKey(PhabricatorHomeLauncherProfileMenuItem::MENUITEMKEY);
73
74
$items[] = $this->newDividerItem('tail');
75
76
$items[] = $this->newManageItem();
77
78
return $items;
79
}
80
81
}
82
83