@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 PhabricatorProjectDetailsProfileMenuItem
4 extends PhabricatorProfileMenuItem {
5
6 const MENUITEMKEY = 'project.details';
7
8 public function getMenuItemTypeName() {
9 return pht('Project Details');
10 }
11
12 private function getDefaultName() {
13 return pht('Project Details');
14 }
15
16 public function getMenuItemTypeIcon() {
17 return 'fa-file-text-o';
18 }
19
20 public function canHideMenuItem(
21 PhabricatorProfileMenuItemConfiguration $config) {
22 return false;
23 }
24
25 public function canMakeDefault(
26 PhabricatorProfileMenuItemConfiguration $config) {
27 return true;
28 }
29
30 public function getDisplayName(
31 PhabricatorProfileMenuItemConfiguration $config) {
32 $name = $config->getMenuItemProperty('name');
33
34 if (phutil_nonempty_string($name)) {
35 return $name;
36 }
37
38 return $this->getDefaultName();
39 }
40
41 public function buildEditEngineFields(
42 PhabricatorProfileMenuItemConfiguration $config) {
43 return array(
44 id(new PhabricatorTextEditField())
45 ->setKey('name')
46 ->setLabel(pht('Name'))
47 ->setPlaceholder($this->getDefaultName())
48 ->setValue($config->getMenuItemProperty('name')),
49 );
50 }
51
52 protected function newMenuItemViewList(
53 PhabricatorProfileMenuItemConfiguration $config) {
54
55 $project = $config->getProfileObject();
56
57 $id = $project->getID();
58 $name = $project->getName();
59 $icon = $project->getDisplayIconIcon();
60
61 $uri = "/project/profile/{$id}/";
62
63 $item = $this->newItemView()
64 ->setURI($uri)
65 ->setName($name)
66 ->setIcon($icon);
67
68 return array(
69 $item,
70 );
71 }
72
73}