diff --git a/src/applications/meta/typeahead/PhabricatorApplicationDatasource.php b/src/applications/meta/typeahead/PhabricatorApplicationDatasource.php --- a/src/applications/meta/typeahead/PhabricatorApplicationDatasource.php +++ b/src/applications/meta/typeahead/PhabricatorApplicationDatasource.php @@ -38,7 +38,9 @@ ->setDisplayType($application->getShortDescription()) ->setImageuRI($application->getIconURI()) ->setPriorityType('apps') - ->setImageSprite('phabricator-search-icon '.$img); + ->setImageSprite('phabricator-search-icon '.$img) + ->setIcon($application->getIcon()) + ->addAttribute($application->getShortDescription()); } return $this->filterResultsAgainstTokens($results); diff --git a/src/applications/settings/panel/PhabricatorHomePreferencesSettingsPanel.php b/src/applications/settings/panel/PhabricatorHomePreferencesSettingsPanel.php --- a/src/applications/settings/panel/PhabricatorHomePreferencesSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorHomePreferencesSettingsPanel.php @@ -67,7 +67,19 @@ unset($options['PhabricatorApplicationsApplication']); if ($request->isFormPost()) { - $pin = $request->getStr('pin'); + $pins = $request->getArr('pin'); + $phid = head($pins); + $app = id(new PhabricatorApplicationQuery()) + ->setViewer($viewer) + ->withPHIDs(array($phid)) + ->executeOne(); + if ($app) { + $pin = get_class($app); + } else { + // This likely means the user submitted an empty form + // which will cause nothing to happen. + $pin = ''; + } if (isset($options[$pin]) && !in_array($pin, $pinned)) { $pinned[] = $pin; @@ -78,18 +90,18 @@ } } - $options_control = id(new AphrontFormSelectControl()) + $options_control = id(new AphrontFormTokenizerControl()) ->setName('pin') ->setLabel(pht('Application')) - ->setOptions($options) - ->setDisabledOptions(array_keys($app_list)); + ->setDatasource(new PhabricatorApplicationDatasource()) + ->setLimit(1); $form = id(new AphrontFormView()) ->setViewer($viewer) ->addHiddenInput('add', 'true') ->appendRemarkupInstructions( pht('Choose an application to pin to your home page.')) - ->appendChild($options_control); + ->appendControl($options_control); return $this->newDialog() ->setWidth(AphrontDialogView::WIDTH_FORM)