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
This commit is contained in:
parent
f6214f060e
commit
58995268dd
|
@ -13,6 +13,12 @@ final class PhabricatorHomeLauncherProfileMenuItem
|
|||
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 @@ final class PhabricatorHomeLauncherProfileMenuItem
|
|||
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(
|
||||
|
|
|
@ -13,6 +13,12 @@ final class PhabricatorHomeProfileMenuItem
|
|||
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 @@ final class PhabricatorHomeProfileMenuItem
|
|||
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();
|
||||
|
|
|
@ -13,22 +13,17 @@ final class PhabricatorPeopleBadgesProfileMenuItem
|
|||
return pht('Badges');
|
||||
}
|
||||
|
||||
public function getDisplayName(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
$default = $this->getDefaultName();
|
||||
return $this->getNameFromConfig($config, $default);
|
||||
}
|
||||
|
||||
public function canHideMenuItem(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
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(
|
||||
|
|
|
@ -13,22 +13,17 @@ final class PhabricatorPeopleCommitsProfileMenuItem
|
|||
return pht('Commits');
|
||||
}
|
||||
|
||||
public function getDisplayName(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
$default = $this->getDefaultName();
|
||||
return $this->getNameFromConfig($config, $default);
|
||||
}
|
||||
|
||||
public function canHideMenuItem(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
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(
|
||||
|
|
|
@ -15,13 +15,8 @@ final class PhabricatorPeopleDetailsProfileMenuItem
|
|||
|
||||
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(
|
||||
|
|
|
@ -13,22 +13,17 @@ final class PhabricatorPeopleManageProfileMenuItem
|
|||
return pht('Manage');
|
||||
}
|
||||
|
||||
public function getDisplayName(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
$default = $this->getDefaultName();
|
||||
return $this->getNameFromConfig($config, $default);
|
||||
}
|
||||
|
||||
public function canHideMenuItem(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
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(
|
||||
|
|
|
@ -13,16 +13,16 @@ final class PhabricatorPeoplePictureProfileMenuItem
|
|||
return pht('User Picture');
|
||||
}
|
||||
|
||||
public function canHideMenuItem(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDisplayName(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
return $this->getDefaultName();
|
||||
}
|
||||
|
||||
public function canHideMenuItem(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function buildEditEngineFields(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
return array();
|
||||
|
|
|
@ -13,22 +13,17 @@ final class PhabricatorPeopleRevisionsProfileMenuItem
|
|||
return pht('Revisions');
|
||||
}
|
||||
|
||||
public function getDisplayName(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
$default = $this->getDefaultName();
|
||||
return $this->getNameFromConfig($config, $default);
|
||||
}
|
||||
|
||||
public function canHideMenuItem(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
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(
|
||||
|
|
|
@ -13,22 +13,17 @@ final class PhabricatorPeopleTasksProfileMenuItem
|
|||
return pht('Tasks');
|
||||
}
|
||||
|
||||
public function getDisplayName(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
$default = $this->getDefaultName();
|
||||
return $this->getNameFromConfig($config, $default);
|
||||
}
|
||||
|
||||
public function canHideMenuItem(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
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(
|
||||
|
|
|
@ -13,6 +13,12 @@ final class PhabricatorProjectDetailsProfileMenuItem
|
|||
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 @@ final class PhabricatorProjectDetailsProfileMenuItem
|
|||
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(
|
||||
|
|
|
@ -13,6 +13,12 @@ final class PhabricatorProjectManageProfileMenuItem
|
|||
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 @@ final class PhabricatorProjectManageProfileMenuItem
|
|||
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(
|
||||
|
|
|
@ -13,19 +13,14 @@ final class PhabricatorProjectMembersProfileMenuItem
|
|||
return pht('Members');
|
||||
}
|
||||
|
||||
public function getMenuItemTypeIcon() {
|
||||
return 'fa-users';
|
||||
}
|
||||
|
||||
public function getDisplayName(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
$name = $config->getMenuItemProperty('name');
|
||||
$default = $this->getDefaultName();
|
||||
return $this->getNameFromConfig($config, $default);
|
||||
}
|
||||
|
||||
if (strlen($name)) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
return $this->getDefaultName();
|
||||
public function getMenuItemTypeIcon() {
|
||||
return 'fa-users';
|
||||
}
|
||||
|
||||
public function buildEditEngineFields(
|
||||
|
|
|
@ -13,6 +13,11 @@ final class PhabricatorProjectPictureProfileMenuItem
|
|||
return pht('Project Picture');
|
||||
}
|
||||
|
||||
public function getDisplayName(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
return $this->getDefaultName();
|
||||
}
|
||||
|
||||
public function getMenuItemTypeIcon() {
|
||||
return 'fa-image';
|
||||
}
|
||||
|
@ -22,11 +27,6 @@ final class PhabricatorProjectPictureProfileMenuItem
|
|||
return false;
|
||||
}
|
||||
|
||||
public function getDisplayName(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
return $this->getDefaultName();
|
||||
}
|
||||
|
||||
public function buildEditEngineFields(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
return array();
|
||||
|
|
|
@ -13,6 +13,11 @@ final class PhabricatorProjectPointsProfileMenuItem
|
|||
return pht('Points Bar');
|
||||
}
|
||||
|
||||
public function getDisplayName(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
return $this->getDefaultName();
|
||||
}
|
||||
|
||||
public function shouldEnableForObject($object) {
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
|
@ -35,11 +40,6 @@ final class PhabricatorProjectPointsProfileMenuItem
|
|||
return true;
|
||||
}
|
||||
|
||||
public function getDisplayName(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
return $this->getDefaultName();
|
||||
}
|
||||
|
||||
public function buildEditEngineFields(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
return array(
|
||||
|
|
|
@ -13,6 +13,12 @@ final class PhabricatorProjectReportsProfileMenuItem
|
|||
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 @@ final class PhabricatorProjectReportsProfileMenuItem
|
|||
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(
|
||||
|
|
|
@ -13,6 +13,12 @@ final class PhabricatorProjectSubprojectsProfileMenuItem
|
|||
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 @@ final class PhabricatorProjectSubprojectsProfileMenuItem
|
|||
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(
|
||||
|
|
|
@ -13,6 +13,12 @@ final class PhabricatorProjectWorkboardProfileMenuItem
|
|||
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 @@ final class PhabricatorProjectWorkboardProfileMenuItem
|
|||
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(
|
||||
|
|
|
@ -26,12 +26,8 @@ final class PhabricatorApplicationProfileMenuItem
|
|||
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 @@ final class PhabricatorApplicationProfileMenuItem
|
|||
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();
|
||||
|
|
|
@ -69,12 +69,8 @@ final class PhabricatorConpherenceProfileMenuItem
|
|||
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 @@ final class PhabricatorConpherenceProfileMenuItem
|
|||
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();
|
||||
|
|
|
@ -43,7 +43,6 @@ final class PhabricatorDashboardProfileMenuItem
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
public function newPageContent(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
$viewer = $this->getViewer();
|
||||
|
@ -104,24 +103,19 @@ final class PhabricatorDashboardProfileMenuItem
|
|||
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 @@ final class PhabricatorDashboardProfileMenuItem
|
|||
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) {
|
||||
|
||||
|
|
|
@ -71,11 +71,9 @@ final class PhabricatorEditEngineProfileMenuItem
|
|||
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 @@ final class PhabricatorEditEngineProfileMenuItem
|
|||
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) {
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ final class PhabricatorLabelProfileMenuItem
|
|||
|
||||
public function getDisplayName(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
return $this->getLabelName($config);
|
||||
return $this->getNameFromConfig($config);
|
||||
}
|
||||
|
||||
public function buildEditEngineFields(
|
||||
|
@ -30,22 +30,15 @@ final class PhabricatorLabelProfileMenuItem
|
|||
->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(
|
||||
|
|
|
@ -23,7 +23,7 @@ final class PhabricatorLinkProfileMenuItem
|
|||
|
||||
public function getDisplayName(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
return $this->getLinkName($config);
|
||||
return $this->getNameFromConfig($config);
|
||||
}
|
||||
|
||||
public function buildEditEngineFields(
|
||||
|
@ -33,7 +33,7 @@ final class PhabricatorLinkProfileMenuItem
|
|||
->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 @@ final class PhabricatorLinkProfileMenuItem
|
|||
);
|
||||
}
|
||||
|
||||
private function getLinkName(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
return $config->getMenuItemProperty('name');
|
||||
}
|
||||
|
||||
private function getLinkIcon(
|
||||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
return $config->getMenuItemProperty('icon', 'link');
|
||||
|
@ -75,7 +70,7 @@ final class PhabricatorLinkProfileMenuItem
|
|||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
|
||||
$icon = $this->getLinkIcon($config);
|
||||
$name = $this->getLinkName($config);
|
||||
$name = $this->getNameFromConfig($config);
|
||||
$uri = $this->getLinkURI($config);
|
||||
$tooltip = $this->getLinkTooltip($config);
|
||||
|
||||
|
|
|
@ -13,6 +13,12 @@ final class PhabricatorManageProfileMenuItem
|
|||
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 @@ final class PhabricatorManageProfileMenuItem
|
|||
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 @@ final class PhabricatorManageProfileMenuItem
|
|||
->setKey('name')
|
||||
->setLabel(pht('Name'))
|
||||
->setPlaceholder($this->getDefaultName())
|
||||
->setValue($config->getMenuItemProperty('name')),
|
||||
->setValue($this->getNameFromConfig($config)),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,11 +22,10 @@ final class PhabricatorMotivatorProfileMenuItem
|
|||
|
||||
$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(
|
||||
|
|
|
@ -14,6 +14,17 @@ abstract class PhabricatorProfileMenuItem extends Phobject {
|
|||
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();
|
||||
|
|
|
@ -62,11 +62,9 @@ final class PhabricatorProjectProfileMenuItem
|
|||
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 @@ final class PhabricatorProjectProfileMenuItem
|
|||
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) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue