From d135b3f2d56f0ecc4c3c184ed18fdb13cc063e13 Mon Sep 17 00:00:00 2001 From: Josh Cox Date: Wed, 24 Aug 2016 18:11:15 -0400 Subject: [PATCH] Added application name to the typeahead results for doc type search Summary: Ref T10951. This adds the application name as an attribute below the document type in the UI for doc type search. Test Plan: Verify that the application name appears as an attribute on the document type results. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T10951 Differential Revision: https://secure.phabricator.com/D16446 --- .../PhabricatorSearchDocumentTypeDatasource.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/applications/search/typeahead/PhabricatorSearchDocumentTypeDatasource.php b/src/applications/search/typeahead/PhabricatorSearchDocumentTypeDatasource.php index 860620023c..c99cc4ede3 100644 --- a/src/applications/search/typeahead/PhabricatorSearchDocumentTypeDatasource.php +++ b/src/applications/search/typeahead/PhabricatorSearchDocumentTypeDatasource.php @@ -30,17 +30,25 @@ final class PhabricatorSearchDocumentTypeDatasource PhabricatorSearchApplicationSearchEngine::getIndexableDocumentTypes( $viewer); - $icons = mpull( - PhabricatorPHIDType::getAllTypes(), - 'getTypeIcon', + $phid_types = mpull(PhabricatorPHIDType::getAllTypes(), + null, 'getTypeConstant'); $results = array(); foreach ($types as $type => $name) { + $type_object = idx($phid_types, $type); + if (!$type_object) { + continue; + } + $application_class = $type_object->getPHIDTypeApplicationClass(); + $application = PhabricatorApplication::getByClass($application_class); + $application_name = $application->getName(); + $results[$type] = id(new PhabricatorTypeaheadResult()) ->setPHID($type) ->setName($name) - ->setIcon(idx($icons, $type)); + ->addAttribute($application_name) + ->setIcon($type_object->getTypeIcon()); } return $results;