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 @@ -21,13 +21,17 @@ public function getDisplayName( PhabricatorProfileMenuItemConfiguration $config) { - $app = $this->getApplication($config); - if ($app) { - return $app->getName(); - } else { - return pht('(Uninstalled Application)'); + $application = $this->getApplication($config); + if (!$application) { + return pht('(Restricted/Invalid Application)'); + } + + $name = $this->getName($config); + if (strlen($name)) { + return $name; } - return $app->getName(); + + return $application->getName(); } public function buildEditEngineFields( @@ -40,9 +44,18 @@ ->setDatasource(new PhabricatorApplicationDatasource()) ->setIsRequired(true) ->setSingleValue($config->getMenuItemProperty('application')), + id(new PhabricatorTextEditField()) + ->setKey('name') + ->setLabel(pht('Name')) + ->setValue($this->getName($config)), ); } + private function getName( + PhabricatorProfileMenuItemConfiguration $config) { + return $config->getMenuItemProperty('name'); + } + private function getApplication( PhabricatorProfileMenuItemConfiguration $config) { $viewer = $this->getViewer(); @@ -73,7 +86,7 @@ $item = $this->newItem() ->setHref($app->getApplicationURI()) - ->setName($app->getName()) + ->setName($this->getDisplayName($config)) ->setIcon($app->getIcon()); return array( 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 @@ -72,16 +72,16 @@ public function buildEditEngineFields( PhabricatorProfileMenuItemConfiguration $config) { return array( - id(new PhabricatorTextEditField()) - ->setKey('name') - ->setLabel(pht('Name')) - ->setValue($this->getName($config)), id(new PhabricatorDatasourceEditField()) ->setKey(self::FIELD_DASHBOARD) ->setLabel(pht('Dashboard')) ->setIsRequired(true) ->setDatasource(new PhabricatorDashboardDatasource()) ->setSingleValue($config->getMenuItemProperty('dashboardPHID')), + id(new PhabricatorTextEditField()) + ->setKey('name') + ->setLabel(pht('Name')) + ->setValue($this->getName($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 @@ -81,16 +81,16 @@ public function buildEditEngineFields( PhabricatorProfileMenuItemConfiguration $config) { return array( - id(new PhabricatorTextEditField()) - ->setKey('name') - ->setLabel(pht('Name')) - ->setValue($this->getName($config)), id(new PhabricatorDatasourceEditField()) ->setKey(self::FIELD_FORM) ->setLabel(pht('Form')) ->setIsRequired(true) ->setDatasource(new PhabricatorEditEngineDatasource()) ->setSingleValue($config->getMenuItemProperty('formKey')), + id(new PhabricatorTextEditField()) + ->setKey('name') + ->setLabel(pht('Name')) + ->setValue($this->getName($config)), ); } 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 @@ -72,16 +72,16 @@ public function buildEditEngineFields( PhabricatorProfileMenuItemConfiguration $config) { return array( - id(new PhabricatorTextEditField()) - ->setKey('name') - ->setLabel(pht('Name')) - ->setValue($this->getName($config)), id(new PhabricatorDatasourceEditField()) ->setKey(self::FIELD_PROJECT) ->setLabel(pht('Project')) ->setIsRequired(true) ->setDatasource(new PhabricatorProjectDatasource()) ->setSingleValue($config->getMenuItemProperty('project')), + id(new PhabricatorTextEditField()) + ->setKey('name') + ->setLabel(pht('Name')) + ->setValue($this->getName($config)), ); }