Page MenuHomePhabricator

D21863.diff
No OneTemporary

D21863.diff

diff --git a/src/applications/home/menuitem/PhabricatorHomeLauncherProfileMenuItem.php b/src/applications/home/menuitem/PhabricatorHomeLauncherProfileMenuItem.php
--- a/src/applications/home/menuitem/PhabricatorHomeLauncherProfileMenuItem.php
+++ b/src/applications/home/menuitem/PhabricatorHomeLauncherProfileMenuItem.php
@@ -13,6 +13,12 @@
return pht('More Applications');
}
+ public function getDisplayName(
+ PhabricatorProfileMenuItemConfiguration $config) {
+ $default = $this->getDefaultName();
+ return $this->getNameFromConfig($config, $default);
+ }
+
public function getMenuItemTypeIcon() {
return 'fa-ellipsis-h';
}
@@ -27,17 +33,6 @@
return false;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
diff --git a/src/applications/home/menuitem/PhabricatorHomeProfileMenuItem.php b/src/applications/home/menuitem/PhabricatorHomeProfileMenuItem.php
--- a/src/applications/home/menuitem/PhabricatorHomeProfileMenuItem.php
+++ b/src/applications/home/menuitem/PhabricatorHomeProfileMenuItem.php
@@ -13,6 +13,12 @@
return pht('Home');
}
+ public function getDisplayName(
+ PhabricatorProfileMenuItemConfiguration $config) {
+ $default = $this->getDefaultName();
+ return $this->getNameFromConfig($config, $default);
+ }
+
public function getMenuItemTypeIcon() {
return 'fa-home';
}
@@ -22,17 +28,6 @@
return true;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function newPageContent(
PhabricatorProfileMenuItemConfiguration $config) {
$viewer = $this->getViewer();
diff --git a/src/applications/people/menuitem/PhabricatorPeopleBadgesProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeopleBadgesProfileMenuItem.php
--- a/src/applications/people/menuitem/PhabricatorPeopleBadgesProfileMenuItem.php
+++ b/src/applications/people/menuitem/PhabricatorPeopleBadgesProfileMenuItem.php
@@ -13,20 +13,15 @@
return pht('Badges');
}
- public function canHideMenuItem(
+ public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config) {
- return true;
+ $default = $this->getDefaultName();
+ return $this->getNameFromConfig($config, $default);
}
- public function getDisplayName(
+ public function canHideMenuItem(
PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
+ return true;
}
public function buildEditEngineFields(
diff --git a/src/applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php
--- a/src/applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php
+++ b/src/applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php
@@ -13,20 +13,15 @@
return pht('Commits');
}
- public function canHideMenuItem(
+ public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config) {
- return true;
+ $default = $this->getDefaultName();
+ return $this->getNameFromConfig($config, $default);
}
- public function getDisplayName(
+ public function canHideMenuItem(
PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
+ return true;
}
public function buildEditEngineFields(
diff --git a/src/applications/people/menuitem/PhabricatorPeopleDetailsProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeopleDetailsProfileMenuItem.php
--- a/src/applications/people/menuitem/PhabricatorPeopleDetailsProfileMenuItem.php
+++ b/src/applications/people/menuitem/PhabricatorPeopleDetailsProfileMenuItem.php
@@ -15,13 +15,8 @@
public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
+ $default = $this->getDefaultName();
+ return $this->getNameFromConfig($config, $default);
}
public function buildEditEngineFields(
diff --git a/src/applications/people/menuitem/PhabricatorPeopleManageProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeopleManageProfileMenuItem.php
--- a/src/applications/people/menuitem/PhabricatorPeopleManageProfileMenuItem.php
+++ b/src/applications/people/menuitem/PhabricatorPeopleManageProfileMenuItem.php
@@ -13,20 +13,15 @@
return pht('Manage');
}
- public function canHideMenuItem(
+ public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config) {
- return false;
+ $default = $this->getDefaultName();
+ return $this->getNameFromConfig($config, $default);
}
- public function getDisplayName(
+ public function canHideMenuItem(
PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
+ return false;
}
public function buildEditEngineFields(
diff --git a/src/applications/people/menuitem/PhabricatorPeoplePictureProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeoplePictureProfileMenuItem.php
--- a/src/applications/people/menuitem/PhabricatorPeoplePictureProfileMenuItem.php
+++ b/src/applications/people/menuitem/PhabricatorPeoplePictureProfileMenuItem.php
@@ -13,14 +13,14 @@
return pht('User Picture');
}
- public function canHideMenuItem(
+ public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config) {
- return false;
+ return $this->getDefaultName();
}
- public function getDisplayName(
+ public function canHideMenuItem(
PhabricatorProfileMenuItemConfiguration $config) {
- return $this->getDefaultName();
+ return false;
}
public function buildEditEngineFields(
diff --git a/src/applications/people/menuitem/PhabricatorPeopleRevisionsProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeopleRevisionsProfileMenuItem.php
--- a/src/applications/people/menuitem/PhabricatorPeopleRevisionsProfileMenuItem.php
+++ b/src/applications/people/menuitem/PhabricatorPeopleRevisionsProfileMenuItem.php
@@ -13,20 +13,15 @@
return pht('Revisions');
}
- public function canHideMenuItem(
+ public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config) {
- return true;
+ $default = $this->getDefaultName();
+ return $this->getNameFromConfig($config, $default);
}
- public function getDisplayName(
+ public function canHideMenuItem(
PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
+ return true;
}
public function buildEditEngineFields(
diff --git a/src/applications/people/menuitem/PhabricatorPeopleTasksProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeopleTasksProfileMenuItem.php
--- a/src/applications/people/menuitem/PhabricatorPeopleTasksProfileMenuItem.php
+++ b/src/applications/people/menuitem/PhabricatorPeopleTasksProfileMenuItem.php
@@ -13,20 +13,15 @@
return pht('Tasks');
}
- public function canHideMenuItem(
+ public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config) {
- return true;
+ $default = $this->getDefaultName();
+ return $this->getNameFromConfig($config, $default);
}
- public function getDisplayName(
+ public function canHideMenuItem(
PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
+ return true;
}
public function buildEditEngineFields(
diff --git a/src/applications/project/menuitem/PhabricatorProjectDetailsProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectDetailsProfileMenuItem.php
--- a/src/applications/project/menuitem/PhabricatorProjectDetailsProfileMenuItem.php
+++ b/src/applications/project/menuitem/PhabricatorProjectDetailsProfileMenuItem.php
@@ -13,6 +13,12 @@
return pht('Project Details');
}
+ public function getDisplayName(
+ PhabricatorProfileMenuItemConfiguration $config) {
+ $default = $this->getDefaultName();
+ return $this->getNameFromConfig($config, $default);
+ }
+
public function getMenuItemTypeIcon() {
return 'fa-file-text-o';
}
@@ -27,17 +33,6 @@
return true;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
diff --git a/src/applications/project/menuitem/PhabricatorProjectManageProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectManageProfileMenuItem.php
--- a/src/applications/project/menuitem/PhabricatorProjectManageProfileMenuItem.php
+++ b/src/applications/project/menuitem/PhabricatorProjectManageProfileMenuItem.php
@@ -13,6 +13,12 @@
return pht('Manage');
}
+ public function getDisplayName(
+ PhabricatorProfileMenuItemConfiguration $config) {
+ $default = $this->getDefaultName();
+ return $this->getNameFromConfig($config, $default);
+ }
+
public function getMenuItemTypeIcon() {
return 'fa-cog';
}
@@ -27,17 +33,6 @@
return true;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
diff --git a/src/applications/project/menuitem/PhabricatorProjectMembersProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectMembersProfileMenuItem.php
--- a/src/applications/project/menuitem/PhabricatorProjectMembersProfileMenuItem.php
+++ b/src/applications/project/menuitem/PhabricatorProjectMembersProfileMenuItem.php
@@ -13,19 +13,14 @@
return pht('Members');
}
- public function getMenuItemTypeIcon() {
- return 'fa-users';
- }
-
public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
+ $default = $this->getDefaultName();
+ return $this->getNameFromConfig($config, $default);
+ }
- return $this->getDefaultName();
+ public function getMenuItemTypeIcon() {
+ return 'fa-users';
}
public function buildEditEngineFields(
diff --git a/src/applications/project/menuitem/PhabricatorProjectPictureProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectPictureProfileMenuItem.php
--- a/src/applications/project/menuitem/PhabricatorProjectPictureProfileMenuItem.php
+++ b/src/applications/project/menuitem/PhabricatorProjectPictureProfileMenuItem.php
@@ -13,6 +13,11 @@
return pht('Project Picture');
}
+ public function getDisplayName(
+ PhabricatorProfileMenuItemConfiguration $config) {
+ return $this->getDefaultName();
+ }
+
public function getMenuItemTypeIcon() {
return 'fa-image';
}
@@ -22,11 +27,6 @@
return false;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array();
diff --git a/src/applications/project/menuitem/PhabricatorProjectPointsProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectPointsProfileMenuItem.php
--- a/src/applications/project/menuitem/PhabricatorProjectPointsProfileMenuItem.php
+++ b/src/applications/project/menuitem/PhabricatorProjectPointsProfileMenuItem.php
@@ -13,6 +13,11 @@
return pht('Points Bar');
}
+ public function getDisplayName(
+ PhabricatorProfileMenuItemConfiguration $config) {
+ return $this->getDefaultName();
+ }
+
public function shouldEnableForObject($object) {
$viewer = $this->getViewer();
@@ -35,11 +40,6 @@
return true;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
diff --git a/src/applications/project/menuitem/PhabricatorProjectReportsProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectReportsProfileMenuItem.php
--- a/src/applications/project/menuitem/PhabricatorProjectReportsProfileMenuItem.php
+++ b/src/applications/project/menuitem/PhabricatorProjectReportsProfileMenuItem.php
@@ -13,6 +13,12 @@
return pht('Reports (Prototype)');
}
+ public function getDisplayName(
+ PhabricatorProfileMenuItemConfiguration $config) {
+ $default = $this->getDefaultName();
+ return $this->getNameFromConfig($config, $default);
+ }
+
public function getMenuItemTypeIcon() {
return 'fa-area-chart';
}
@@ -42,17 +48,6 @@
return true;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
diff --git a/src/applications/project/menuitem/PhabricatorProjectSubprojectsProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectSubprojectsProfileMenuItem.php
--- a/src/applications/project/menuitem/PhabricatorProjectSubprojectsProfileMenuItem.php
+++ b/src/applications/project/menuitem/PhabricatorProjectSubprojectsProfileMenuItem.php
@@ -13,6 +13,12 @@
return pht('Subprojects');
}
+ public function getDisplayName(
+ PhabricatorProfileMenuItemConfiguration $config) {
+ $default = $this->getDefaultName();
+ return $this->getNameFromConfig($config, $default);
+ }
+
public function getMenuItemTypeIcon() {
return 'fa-sitemap';
}
@@ -25,17 +31,6 @@
return true;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
diff --git a/src/applications/project/menuitem/PhabricatorProjectWorkboardProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectWorkboardProfileMenuItem.php
--- a/src/applications/project/menuitem/PhabricatorProjectWorkboardProfileMenuItem.php
+++ b/src/applications/project/menuitem/PhabricatorProjectWorkboardProfileMenuItem.php
@@ -13,6 +13,12 @@
return pht('Workboard');
}
+ public function getDisplayName(
+ PhabricatorProfileMenuItemConfiguration $config) {
+ $default = $this->getDefaultName();
+ return $this->getNameFromConfig($config, $default);
+ }
+
public function getMenuItemTypeIcon() {
return 'fa-columns';
}
@@ -34,17 +40,6 @@
return true;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
diff --git a/src/applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php
--- a/src/applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php
@@ -26,12 +26,8 @@
return pht('(Restricted/Invalid Application)');
}
- $name = $this->getName($config);
- if (strlen($name)) {
- return $name;
- }
-
- return $application->getName();
+ $default = $application->getName();
+ return $this->getNameFromConfig($config, $default);
}
public function buildEditEngineFields(
@@ -46,15 +42,10 @@
id(new PhabricatorTextEditField())
->setKey('name')
->setLabel(pht('Name'))
- ->setValue($this->getName($config)),
+ ->setValue($this->getNameFromConfig($config)),
);
}
- private function getName(
- PhabricatorProfileMenuItemConfiguration $config) {
- return $config->getMenuItemProperty('name');
- }
-
private function getApplication(
PhabricatorProfileMenuItemConfiguration $config) {
$viewer = $this->getViewer();
diff --git a/src/applications/search/menuitem/PhabricatorConpherenceProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorConpherenceProfileMenuItem.php
--- a/src/applications/search/menuitem/PhabricatorConpherenceProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorConpherenceProfileMenuItem.php
@@ -69,12 +69,8 @@
return pht('(Restricted/Invalid Conpherence)');
}
- $name = $this->getName($config);
- if (strlen($name)) {
- return $name;
- }
-
- return $room->getTitle();
+ $default = $room->getTitle();
+ return $this->getNameFromConfig($config, $default);
}
public function buildEditEngineFields(
@@ -89,15 +85,10 @@
id(new PhabricatorTextEditField())
->setKey('name')
->setLabel(pht('Name'))
- ->setValue($this->getName($config)),
+ ->setValue($this->getNameFromConfig($config)),
);
}
- private function getName(
- PhabricatorProfileMenuItemConfiguration $config) {
- return $config->getMenuItemProperty('name');
- }
-
protected function newMenuItemViewList(
PhabricatorProfileMenuItemConfiguration $config) {
$viewer = $this->getViewer();
diff --git a/src/applications/search/menuitem/PhabricatorDashboardProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorDashboardProfileMenuItem.php
--- a/src/applications/search/menuitem/PhabricatorDashboardProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorDashboardProfileMenuItem.php
@@ -43,7 +43,6 @@
);
}
-
public function newPageContent(
PhabricatorProfileMenuItemConfiguration $config) {
$viewer = $this->getViewer();
@@ -104,24 +103,19 @@
public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config) {
$dashboard = $this->getDashboard();
-
if (!$dashboard) {
if ($this->getDashboardHandle()->getPolicyFiltered()) {
return pht('Restricted Dashboard');
- } else {
- return pht('Invalid Dashboard');
}
+ return pht('Invalid Dashboard');
}
if ($dashboard->isArchived()) {
return pht('Archived Dashboard');
}
- if (strlen($this->getName($config))) {
- return $this->getName($config);
- } else {
- return $dashboard->getName();
- }
+ $default = $dashboard->getName();
+ return $this->getNameFromConfig($config, $default);
}
public function buildEditEngineFields(
@@ -136,15 +130,10 @@
id(new PhabricatorTextEditField())
->setKey('name')
->setLabel(pht('Name'))
- ->setValue($this->getName($config)),
+ ->setValue($this->getNameFromConfig($config)),
);
}
- private function getName(
- PhabricatorProfileMenuItemConfiguration $config) {
- return $config->getMenuItemProperty('name');
- }
-
protected function newMenuItemViewList(
PhabricatorProfileMenuItemConfiguration $config) {
diff --git a/src/applications/search/menuitem/PhabricatorEditEngineProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorEditEngineProfileMenuItem.php
--- a/src/applications/search/menuitem/PhabricatorEditEngineProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorEditEngineProfileMenuItem.php
@@ -71,11 +71,9 @@
if (!$form) {
return pht('(Restricted/Invalid Form)');
}
- if (strlen($this->getName($config))) {
- return $this->getName($config);
- } else {
- return $form->getName();
- }
+
+ $default = $form->getName();
+ return $this->getNameFromConfig($config, $default);
}
public function buildEditEngineFields(
@@ -90,15 +88,10 @@
id(new PhabricatorTextEditField())
->setKey('name')
->setLabel(pht('Name'))
- ->setValue($this->getName($config)),
+ ->setValue($this->getNameFromConfig($config)),
);
}
- private function getName(
- PhabricatorProfileMenuItemConfiguration $config) {
- return $config->getMenuItemProperty('name');
- }
-
protected function newMenuItemViewList(
PhabricatorProfileMenuItemConfiguration $config) {
diff --git a/src/applications/search/menuitem/PhabricatorLabelProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorLabelProfileMenuItem.php
--- a/src/applications/search/menuitem/PhabricatorLabelProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorLabelProfileMenuItem.php
@@ -20,7 +20,7 @@
public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config) {
- return $this->getLabelName($config);
+ return $this->getNameFromConfig($config);
}
public function buildEditEngineFields(
@@ -30,22 +30,15 @@
->setKey(self::FIELD_NAME)
->setLabel(pht('Name'))
->setIsRequired(true)
- ->setValue($this->getLabelName($config)),
+ ->setValue($this->getNameFromConfig($config)),
);
}
- private function getLabelName(
- PhabricatorProfileMenuItemConfiguration $config) {
- return $config->getMenuItemProperty('name');
- }
-
protected function newMenuItemViewList(
PhabricatorProfileMenuItemConfiguration $config) {
- $name = $this->getLabelName($config);
-
$item = $this->newItemView()
- ->setName($name)
+ ->setName($this->getNameFromConfig($config))
->setIsLabel(true);
return array(
diff --git a/src/applications/search/menuitem/PhabricatorLinkProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorLinkProfileMenuItem.php
--- a/src/applications/search/menuitem/PhabricatorLinkProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorLinkProfileMenuItem.php
@@ -23,7 +23,7 @@
public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config) {
- return $this->getLinkName($config);
+ return $this->getNameFromConfig($config);
}
public function buildEditEngineFields(
@@ -33,7 +33,7 @@
->setKey(self::FIELD_NAME)
->setLabel(pht('Name'))
->setIsRequired(true)
- ->setValue($this->getLinkName($config)),
+ ->setValue($this->getNameFromConfig($config)),
id(new PhabricatorTextEditField())
->setKey(self::FIELD_URI)
->setLabel(pht('URI'))
@@ -51,11 +51,6 @@
);
}
- private function getLinkName(
- PhabricatorProfileMenuItemConfiguration $config) {
- return $config->getMenuItemProperty('name');
- }
-
private function getLinkIcon(
PhabricatorProfileMenuItemConfiguration $config) {
return $config->getMenuItemProperty('icon', 'link');
@@ -75,7 +70,7 @@
PhabricatorProfileMenuItemConfiguration $config) {
$icon = $this->getLinkIcon($config);
- $name = $this->getLinkName($config);
+ $name = $this->getNameFromConfig($config);
$uri = $this->getLinkURI($config);
$tooltip = $this->getLinkTooltip($config);
diff --git a/src/applications/search/menuitem/PhabricatorManageProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorManageProfileMenuItem.php
--- a/src/applications/search/menuitem/PhabricatorManageProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorManageProfileMenuItem.php
@@ -13,6 +13,12 @@
return pht('Edit Menu');
}
+ public function getDisplayName(
+ PhabricatorProfileMenuItemConfiguration $config) {
+ $default = $this->getDefaultName();
+ return $this->getNameFromConfig($config, $default);
+ }
+
public function getMenuItemTypeIcon() {
return 'fa-pencil';
}
@@ -27,17 +33,6 @@
return false;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
@@ -45,7 +40,7 @@
->setKey('name')
->setLabel(pht('Name'))
->setPlaceholder($this->getDefaultName())
- ->setValue($config->getMenuItemProperty('name')),
+ ->setValue($this->getNameFromConfig($config)),
);
}
diff --git a/src/applications/search/menuitem/PhabricatorMotivatorProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorMotivatorProfileMenuItem.php
--- a/src/applications/search/menuitem/PhabricatorMotivatorProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorMotivatorProfileMenuItem.php
@@ -22,11 +22,10 @@
$options = $this->getOptions();
$name = idx($options, $config->getMenuItemProperty('source'));
- if ($name !== null) {
+ if ($name !== null && strlen($name)) {
return pht('Motivator: %s', $name);
- } else {
- return pht('Motivator');
}
+ return pht('Motivator');
}
public function buildEditEngineFields(
diff --git a/src/applications/search/menuitem/PhabricatorProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorProfileMenuItem.php
--- a/src/applications/search/menuitem/PhabricatorProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorProfileMenuItem.php
@@ -14,6 +14,17 @@
abstract public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config);
+ protected function getNameFromConfig(
+ PhabricatorProfileMenuItemConfiguration $config,
+ $default = '') {
+ $name = $config->getMenuItemProperty('name');
+
+ if ($name !== null && strlen($name)) {
+ return $name;
+ }
+ return $default;
+ }
+
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array();
diff --git a/src/applications/search/menuitem/PhabricatorProjectProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorProjectProfileMenuItem.php
--- a/src/applications/search/menuitem/PhabricatorProjectProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorProjectProfileMenuItem.php
@@ -62,11 +62,9 @@
if (!$project) {
return pht('(Restricted/Invalid Project)');
}
- if (strlen($this->getName($config))) {
- return $this->getName($config);
- } else {
- return $project->getName();
- }
+
+ $default = $project->getName();
+ return $this->getNameFromConfig($config, $default);
}
public function buildEditEngineFields(
@@ -81,15 +79,10 @@
id(new PhabricatorTextEditField())
->setKey('name')
->setLabel(pht('Name'))
- ->setValue($this->getName($config)),
+ ->setValue($this->getNameFromConfig($config)),
);
}
- private function getName(
- PhabricatorProfileMenuItemConfiguration $config) {
- return $config->getMenuItemProperty('name');
- }
-
protected function newMenuItemViewList(
PhabricatorProfileMenuItemConfiguration $config) {

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 10:15 AM (20 h, 50 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6782217
Default Alt Text
D21863.diff (28 KB)

Event Timeline