Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2892997
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
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
@@ -1,49 +1,57 @@
<?php
final class PhabricatorSearchDocumentTypeDatasource
extends PhabricatorTypeaheadDatasource {
public function getBrowseTitle() {
return pht('Browse Document Types');
}
public function getPlaceholderText() {
return pht('Select a document type...');
}
public function getDatasourceApplicationClass() {
return 'PhabricatorSearchApplication';
}
public function loadResults() {
$results = $this->buildResults();
return $this->filterResultsAgainstTokens($results);
}
public function renderTokens(array $values) {
return $this->renderTokensFromResults($this->buildResults(), $values);
}
private function buildResults() {
$viewer = $this->getViewer();
$types =
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;
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Jan 19, 17:41 (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1127068
Default Alt Text
(2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment