Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F72597083
AlmanacServiceTypeDatasource.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, Jul 16, 01:54
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Jul 18, 01:54 (2 d)
Engine
blob
Format
Raw Data
Handle
19074834
Attached To
rPH Phabricator
AlmanacServiceTypeDatasource.php
View Options
<?php
final
class
AlmanacServiceTypeDatasource
extends
PhabricatorTypeaheadDatasource
{
public
function
getBrowseTitle
()
{
return
pht
(
'Browse Service Types'
);
}
public
function
getPlaceholderText
()
{
return
pht
(
'Type a service type name...'
);
}
public
function
getDatasourceApplicationClass
()
{
return
'PhabricatorAlmanacApplication'
;
}
public
function
loadResults
()
{
$results
=
$this
->
buildResults
();
return
$this
->
filterResultsAgainstTokens
(
$results
);
}
protected
function
renderSpecialTokens
(
array
$values
)
{
return
$this
->
renderTokensFromResults
(
$this
->
buildResults
(),
$values
);
}
private
function
buildResults
()
{
$results
=
array
();
$types
=
AlmanacServiceType
::
getAllServiceTypes
();
$results
=
array
();
foreach
(
$types
as
$key
=>
$type
)
{
$results
[
$key
]
=
id
(
new
PhabricatorTypeaheadResult
())
->
setName
(
$type
->
getServiceTypeName
())
->
setIcon
(
$type
->
getServiceTypeIcon
())
->
setPHID
(
$key
);
}
return
$results
;
}
}
Event Timeline
Log In to Comment