Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/home/menuitem/PhabricatorHomeProfileMenuItem.php
12256 views
1
<?php
2
3
final class PhabricatorHomeProfileMenuItem
4
extends PhabricatorProfileMenuItem {
5
6
const MENUITEMKEY = 'home.dashboard';
7
8
public function getMenuItemTypeName() {
9
return pht('Built-in Homepage');
10
}
11
12
private function getDefaultName() {
13
return pht('Home');
14
}
15
16
public function getDisplayName(
17
PhabricatorProfileMenuItemConfiguration $config) {
18
$default = $this->getDefaultName();
19
return $this->getNameFromConfig($config, $default);
20
}
21
22
public function getMenuItemTypeIcon() {
23
return 'fa-home';
24
}
25
26
public function canMakeDefault(
27
PhabricatorProfileMenuItemConfiguration $config) {
28
return true;
29
}
30
31
public function newPageContent(
32
PhabricatorProfileMenuItemConfiguration $config) {
33
$viewer = $this->getViewer();
34
35
return id(new PHUIHomeView())
36
->setViewer($viewer);
37
}
38
39
public function buildEditEngineFields(
40
PhabricatorProfileMenuItemConfiguration $config) {
41
return array(
42
id(new PhabricatorTextEditField())
43
->setKey('name')
44
->setLabel(pht('Name'))
45
->setPlaceholder($this->getDefaultName())
46
->setValue($config->getMenuItemProperty('name')),
47
);
48
}
49
50
protected function newMenuItemViewList(
51
PhabricatorProfileMenuItemConfiguration $config) {
52
$viewer = $this->getViewer();
53
54
$name = $this->getDisplayName($config);
55
$icon = 'fa-home';
56
$uri = $this->getItemViewURI($config);
57
58
$item = $this->newItemView()
59
->setURI($uri)
60
->setName($name)
61
->setIcon($icon);
62
63
return array(
64
$item,
65
);
66
}
67
68
}
69
70