Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F72550963
DivinerBookDatasource.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
Mon, Jul 15, 17:41
Size
876 B
Mime Type
text/x-php
Expires
Wed, Jul 17, 17:41 (2 d)
Engine
blob
Format
Raw Data
Handle
19069554
Attached To
rPH Phabricator
DivinerBookDatasource.php
View Options
<?php
final
class
DivinerBookDatasource
extends
PhabricatorTypeaheadDatasource
{
public
function
getBrowseTitle
()
{
return
pht
(
'Browse Books'
);
}
public
function
getPlaceholderText
()
{
return
pht
(
'Type a book name...'
);
}
public
function
getDatasourceApplicationClass
()
{
return
'PhabricatorDivinerApplication'
;
}
public
function
loadResults
()
{
$raw_query
=
$this
->
getRawQuery
();
$query
=
id
(
new
DivinerBookQuery
())
->
setOrder
(
'name'
)
->
withNamePrefix
(
$raw_query
);
$books
=
$this
->
executeQuery
(
$query
);
$results
=
array
();
foreach
(
$books
as
$book
)
{
$results
[]
=
id
(
new
PhabricatorTypeaheadResult
())
->
setName
(
$book
->
getTitle
())
->
setURI
(
'/book/'
.
$book
->
getName
().
'/'
)
->
setPHID
(
$book
->
getPHID
())
->
setPriorityString
(
$book
->
getName
());
}
return
$results
;
}
}
Event Timeline
Log In to Comment