Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F83468313
PhabricatorSearchDocumentTypeDatasource.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Sep 17, 07:33
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Sep 19, 07:33 (1 d, 22 h)
Engine
blob
Format
Raw Data
Handle
20841101
Attached To
rPH Phabricator
PhabricatorSearchDocumentTypeDatasource.php
View Options
<?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
()
{
$types
=
PhabricatorSearchApplicationSearchEngine
::
getIndexableDocumentTypes
();
$icons
=
mpull
(
PhabricatorPHIDType
::
getAllTypes
(),
'getTypeIcon'
,
'getTypeConstant'
);
$results
=
array
();
foreach
(
$types
as
$type
=>
$name
)
{
$results
[
$type
]
=
id
(
new
PhabricatorTypeaheadResult
())
->
setPHID
(
$type
)
->
setName
(
$name
)
->
setIcon
(
idx
(
$icons
,
$type
));
}
return
$results
;
}
}
Event Timeline
Log In to Comment