Skip to content

Commit 5899526

Browse files
committedMay 24, 2023
Addressing some PHP8 incompatibilities - ProfileMenuItem
Summary: Updates to all of the `ProfileMenuItem` classes to be compatible with PHP 8. These changes were moved from D21862. Refs T13588 Test Plan: I loaded the profile page for a user and saw all the items I expected to see. I navigated through the different profile nav items. I loaded the settings page for a user and saw all the items I expected to see. I navigated through the differnt setting nave items. I added Cat Facts to my navigation. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T13588 Differential Revision: https://secure.phabricator.com/D21863
1 parent f6214f0 commit 5899526

27 files changed

+132
-252
lines changed
 

‎src/applications/home/menuitem/PhabricatorHomeLauncherProfileMenuItem.php

+6-11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ private function getDefaultName() {
1313
return pht('More Applications');
1414
}
1515

16+
public function getDisplayName(
17+
PhabricatorProfileMenuItemConfiguration $config) {
18+
$default = $this->getDefaultName();
19+
return $this->getNameFromConfig($config, $default);
20+
}
21+
1622
public function getMenuItemTypeIcon() {
1723
return 'fa-ellipsis-h';
1824
}
@@ -27,17 +33,6 @@ public function canMakeDefault(
2733
return false;
2834
}
2935

30-
public function getDisplayName(
31-
PhabricatorProfileMenuItemConfiguration $config) {
32-
$name = $config->getMenuItemProperty('name');
33-
34-
if (strlen($name)) {
35-
return $name;
36-
}
37-
38-
return $this->getDefaultName();
39-
}
40-
4136
public function buildEditEngineFields(
4237
PhabricatorProfileMenuItemConfiguration $config) {
4338
return array(

‎src/applications/home/menuitem/PhabricatorHomeProfileMenuItem.php

+6-11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ private function getDefaultName() {
1313
return pht('Home');
1414
}
1515

16+
public function getDisplayName(
17+
PhabricatorProfileMenuItemConfiguration $config) {
18+
$default = $this->getDefaultName();
19+
return $this->getNameFromConfig($config, $default);
20+
}
21+
1622
public function getMenuItemTypeIcon() {
1723
return 'fa-home';
1824
}
@@ -22,17 +28,6 @@ public function canMakeDefault(
2228
return true;
2329
}
2430

25-
public function getDisplayName(
26-
PhabricatorProfileMenuItemConfiguration $config) {
27-
$name = $config->getMenuItemProperty('name');
28-
29-
if (strlen($name)) {
30-
return $name;
31-
}
32-
33-
return $this->getDefaultName();
34-
}
35-
3631
public function newPageContent(
3732
PhabricatorProfileMenuItemConfiguration $config) {
3833
$viewer = $this->getViewer();

‎src/applications/people/menuitem/PhabricatorPeopleBadgesProfileMenuItem.php

+5-10
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,15 @@ private function getDefaultName() {
1313
return pht('Badges');
1414
}
1515

16-
public function canHideMenuItem(
16+
public function getDisplayName(
1717
PhabricatorProfileMenuItemConfiguration $config) {
18-
return true;
18+
$default = $this->getDefaultName();
19+
return $this->getNameFromConfig($config, $default);
1920
}
2021

21-
public function getDisplayName(
22+
public function canHideMenuItem(
2223
PhabricatorProfileMenuItemConfiguration $config) {
23-
$name = $config->getMenuItemProperty('name');
24-
25-
if (strlen($name)) {
26-
return $name;
27-
}
28-
29-
return $this->getDefaultName();
24+
return true;
3025
}
3126

3227
public function buildEditEngineFields(

‎src/applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php

+5-10
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,15 @@ private function getDefaultName() {
1313
return pht('Commits');
1414
}
1515

16-
public function canHideMenuItem(
16+
public function getDisplayName(
1717
PhabricatorProfileMenuItemConfiguration $config) {
18-
return true;
18+
$default = $this->getDefaultName();
19+
return $this->getNameFromConfig($config, $default);
1920
}
2021

21-
public function getDisplayName(
22+
public function canHideMenuItem(
2223
PhabricatorProfileMenuItemConfiguration $config) {
23-
$name = $config->getMenuItemProperty('name');
24-
25-
if (strlen($name)) {
26-
return $name;
27-
}
28-
29-
return $this->getDefaultName();
24+
return true;
3025
}
3126

3227
public function buildEditEngineFields(

‎src/applications/people/menuitem/PhabricatorPeopleDetailsProfileMenuItem.php

+2-7
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,8 @@ private function getDefaultName() {
1515

1616
public function getDisplayName(
1717
PhabricatorProfileMenuItemConfiguration $config) {
18-
$name = $config->getMenuItemProperty('name');
19-
20-
if (strlen($name)) {
21-
return $name;
22-
}
23-
24-
return $this->getDefaultName();
18+
$default = $this->getDefaultName();
19+
return $this->getNameFromConfig($config, $default);
2520
}
2621

2722
public function buildEditEngineFields(

‎src/applications/people/menuitem/PhabricatorPeopleManageProfileMenuItem.php

+5-10
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,15 @@ private function getDefaultName() {
1313
return pht('Manage');
1414
}
1515

16-
public function canHideMenuItem(
16+
public function getDisplayName(
1717
PhabricatorProfileMenuItemConfiguration $config) {
18-
return false;
18+
$default = $this->getDefaultName();
19+
return $this->getNameFromConfig($config, $default);
1920
}
2021

21-
public function getDisplayName(
22+
public function canHideMenuItem(
2223
PhabricatorProfileMenuItemConfiguration $config) {
23-
$name = $config->getMenuItemProperty('name');
24-
25-
if (strlen($name)) {
26-
return $name;
27-
}
28-
29-
return $this->getDefaultName();
24+
return false;
3025
}
3126

3227
public function buildEditEngineFields(

‎src/applications/people/menuitem/PhabricatorPeoplePictureProfileMenuItem.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ private function getDefaultName() {
1313
return pht('User Picture');
1414
}
1515

16-
public function canHideMenuItem(
16+
public function getDisplayName(
1717
PhabricatorProfileMenuItemConfiguration $config) {
18-
return false;
18+
return $this->getDefaultName();
1919
}
2020

21-
public function getDisplayName(
21+
public function canHideMenuItem(
2222
PhabricatorProfileMenuItemConfiguration $config) {
23-
return $this->getDefaultName();
23+
return false;
2424
}
2525

2626
public function buildEditEngineFields(

‎src/applications/people/menuitem/PhabricatorPeopleRevisionsProfileMenuItem.php

+5-10
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,15 @@ private function getDefaultName() {
1313
return pht('Revisions');
1414
}
1515

16-
public function canHideMenuItem(
16+
public function getDisplayName(
1717
PhabricatorProfileMenuItemConfiguration $config) {
18-
return true;
18+
$default = $this->getDefaultName();
19+
return $this->getNameFromConfig($config, $default);
1920
}
2021

21-
public function getDisplayName(
22+
public function canHideMenuItem(
2223
PhabricatorProfileMenuItemConfiguration $config) {
23-
$name = $config->getMenuItemProperty('name');
24-
25-
if (strlen($name)) {
26-
return $name;
27-
}
28-
29-
return $this->getDefaultName();
24+
return true;
3025
}
3126

3227
public function buildEditEngineFields(

‎src/applications/people/menuitem/PhabricatorPeopleTasksProfileMenuItem.php

+5-10
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,15 @@ private function getDefaultName() {
1313
return pht('Tasks');
1414
}
1515

16-
public function canHideMenuItem(
16+
public function getDisplayName(
1717
PhabricatorProfileMenuItemConfiguration $config) {
18-
return true;
18+
$default = $this->getDefaultName();
19+
return $this->getNameFromConfig($config, $default);
1920
}
2021

21-
public function getDisplayName(
22+
public function canHideMenuItem(
2223
PhabricatorProfileMenuItemConfiguration $config) {
23-
$name = $config->getMenuItemProperty('name');
24-
25-
if (strlen($name)) {
26-
return $name;
27-
}
28-
29-
return $this->getDefaultName();
24+
return true;
3025
}
3126

3227
public function buildEditEngineFields(

‎src/applications/project/menuitem/PhabricatorProjectDetailsProfileMenuItem.php

+6-11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ private function getDefaultName() {
1313
return pht('Project Details');
1414
}
1515

16+
public function getDisplayName(
17+
PhabricatorProfileMenuItemConfiguration $config) {
18+
$default = $this->getDefaultName();
19+
return $this->getNameFromConfig($config, $default);
20+
}
21+
1622
public function getMenuItemTypeIcon() {
1723
return 'fa-file-text-o';
1824
}
@@ -27,17 +33,6 @@ public function canMakeDefault(
2733
return true;
2834
}
2935

30-
public function getDisplayName(
31-
PhabricatorProfileMenuItemConfiguration $config) {
32-
$name = $config->getMenuItemProperty('name');
33-
34-
if (strlen($name)) {
35-
return $name;
36-
}
37-
38-
return $this->getDefaultName();
39-
}
40-
4136
public function buildEditEngineFields(
4237
PhabricatorProfileMenuItemConfiguration $config) {
4338
return array(

‎src/applications/project/menuitem/PhabricatorProjectManageProfileMenuItem.php

+6-11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ private function getDefaultName() {
1313
return pht('Manage');
1414
}
1515

16+
public function getDisplayName(
17+
PhabricatorProfileMenuItemConfiguration $config) {
18+
$default = $this->getDefaultName();
19+
return $this->getNameFromConfig($config, $default);
20+
}
21+
1622
public function getMenuItemTypeIcon() {
1723
return 'fa-cog';
1824
}
@@ -27,17 +33,6 @@ public function canMakeDefault(
2733
return true;
2834
}
2935

30-
public function getDisplayName(
31-
PhabricatorProfileMenuItemConfiguration $config) {
32-
$name = $config->getMenuItemProperty('name');
33-
34-
if (strlen($name)) {
35-
return $name;
36-
}
37-
38-
return $this->getDefaultName();
39-
}
40-
4136
public function buildEditEngineFields(
4237
PhabricatorProfileMenuItemConfiguration $config) {
4338
return array(

‎src/applications/project/menuitem/PhabricatorProjectMembersProfileMenuItem.php

+5-10
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,14 @@ private function getDefaultName() {
1313
return pht('Members');
1414
}
1515

16-
public function getMenuItemTypeIcon() {
17-
return 'fa-users';
18-
}
19-
2016
public function getDisplayName(
2117
PhabricatorProfileMenuItemConfiguration $config) {
22-
$name = $config->getMenuItemProperty('name');
23-
24-
if (strlen($name)) {
25-
return $name;
26-
}
18+
$default = $this->getDefaultName();
19+
return $this->getNameFromConfig($config, $default);
20+
}
2721

28-
return $this->getDefaultName();
22+
public function getMenuItemTypeIcon() {
23+
return 'fa-users';
2924
}
3025

3126
public function buildEditEngineFields(

‎src/applications/project/menuitem/PhabricatorProjectPictureProfileMenuItem.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ private function getDefaultName() {
1313
return pht('Project Picture');
1414
}
1515

16+
public function getDisplayName(
17+
PhabricatorProfileMenuItemConfiguration $config) {
18+
return $this->getDefaultName();
19+
}
20+
1621
public function getMenuItemTypeIcon() {
1722
return 'fa-image';
1823
}
@@ -22,11 +27,6 @@ public function canHideMenuItem(
2227
return false;
2328
}
2429

25-
public function getDisplayName(
26-
PhabricatorProfileMenuItemConfiguration $config) {
27-
return $this->getDefaultName();
28-
}
29-
3030
public function buildEditEngineFields(
3131
PhabricatorProfileMenuItemConfiguration $config) {
3232
return array();

‎src/applications/project/menuitem/PhabricatorProjectPointsProfileMenuItem.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ private function getDefaultName() {
1313
return pht('Points Bar');
1414
}
1515

16+
public function getDisplayName(
17+
PhabricatorProfileMenuItemConfiguration $config) {
18+
return $this->getDefaultName();
19+
}
20+
1621
public function shouldEnableForObject($object) {
1722
$viewer = $this->getViewer();
1823

@@ -35,11 +40,6 @@ public function shouldEnableForObject($object) {
3540
return true;
3641
}
3742

38-
public function getDisplayName(
39-
PhabricatorProfileMenuItemConfiguration $config) {
40-
return $this->getDefaultName();
41-
}
42-
4343
public function buildEditEngineFields(
4444
PhabricatorProfileMenuItemConfiguration $config) {
4545
return array(

‎src/applications/project/menuitem/PhabricatorProjectReportsProfileMenuItem.php

+6-11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ private function getDefaultName() {
1313
return pht('Reports (Prototype)');
1414
}
1515

16+
public function getDisplayName(
17+
PhabricatorProfileMenuItemConfiguration $config) {
18+
$default = $this->getDefaultName();
19+
return $this->getNameFromConfig($config, $default);
20+
}
21+
1622
public function getMenuItemTypeIcon() {
1723
return 'fa-area-chart';
1824
}
@@ -42,17 +48,6 @@ public function shouldEnableForObject($object) {
4248
return true;
4349
}
4450

45-
public function getDisplayName(
46-
PhabricatorProfileMenuItemConfiguration $config) {
47-
$name = $config->getMenuItemProperty('name');
48-
49-
if (strlen($name)) {
50-
return $name;
51-
}
52-
53-
return $this->getDefaultName();
54-
}
55-
5651
public function buildEditEngineFields(
5752
PhabricatorProfileMenuItemConfiguration $config) {
5853
return array(

0 commit comments

Comments
 (0)
Failed to load comments.