Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F83513107
AlmanacServiceDatasource.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, 13:33
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Sep 19, 13:33 (2 d)
Engine
blob
Format
Raw Data
Handle
20850390
Attached To
rPH Phabricator
AlmanacServiceDatasource.php
View Options
<?php
final
class
AlmanacServiceDatasource
extends
PhabricatorTypeaheadDatasource
{
public
function
getBrowseTitle
()
{
return
pht
(
'Browse Services'
);
}
public
function
getPlaceholderText
()
{
return
pht
(
'Type a service name...'
);
}
public
function
getDatasourceApplicationClass
()
{
return
'PhabricatorAlmanacApplication'
;
}
public
function
loadResults
()
{
$viewer
=
$this
->
getViewer
();
$raw_query
=
$this
->
getRawQuery
();
$services
=
id
(
new
AlmanacServiceQuery
())
->
withNamePrefix
(
$raw_query
)
->
setOrder
(
'name'
);
// TODO: When service classes are restricted, it might be nice to customize
// the title and placeholder text to show which service types can be
// selected, or show all services but mark the invalid ones disabled and
// prevent their selection.
$service_types
=
$this
->
getParameter
(
'serviceTypes'
);
if
(
$service_types
)
{
$services
->
withServiceTypes
(
$service_types
);
}
$services
=
$this
->
executeQuery
(
$services
);
if
(
$services
)
{
$handles
=
id
(
new
PhabricatorHandleQuery
())
->
setViewer
(
$viewer
)
->
withPHIDs
(
mpull
(
$services
,
'getPHID'
))
->
execute
();
}
else
{
$handles
=
array
();
}
$results
=
array
();
foreach
(
$handles
as
$handle
)
{
$results
[]
=
id
(
new
PhabricatorTypeaheadResult
())
->
setName
(
$handle
->
getName
())
->
setPHID
(
$handle
->
getPHID
());
}
return
$results
;
}
}
Event Timeline
Log In to Comment