Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F118171220
PhabricatorProjectSearchField.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
Wed, Jun 18, 05:50
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Jun 20, 05:50 (2 d)
Engine
blob
Format
Raw Data
Handle
26849368
Attached To
rPH Phabricator
PhabricatorProjectSearchField.php
View Options
<?php
final
class
PhabricatorProjectSearchField
extends
PhabricatorSearchTokenizerField
{
protected
function
getDefaultValue
()
{
return
array
();
}
protected
function
newDatasource
()
{
return
new
PhabricatorProjectLogicalDatasource
();
}
protected
function
getValueFromRequest
(
AphrontRequest
$request
,
$key
)
{
$list
=
$this
->
getListFromRequest
(
$request
,
$key
);
$phids
=
array
();
$slugs
=
array
();
$project_type
=
PhabricatorProjectProjectPHIDType
::
TYPECONST
;
foreach
(
$list
as
$item
)
{
$type
=
phid_get_type
(
$item
);
if
(
$type
==
$project_type
)
{
$phids
[]
=
$item
;
}
else
{
if
(
PhabricatorTypeaheadDatasource
::
isFunctionToken
(
$item
))
{
// If this is a function, pass it through unchanged; we'll evaluate
// it later.
$phids
[]
=
$item
;
}
else
{
$slugs
[]
=
$item
;
}
}
}
if
(
$slugs
)
{
$projects
=
id
(
new
PhabricatorProjectQuery
())
->
setViewer
(
$this
->
requireViewer
())
->
withSlugs
(
$slugs
)
->
execute
();
foreach
(
$projects
as
$project
)
{
$phids
[]
=
$project
->
getPHID
();
}
$phids
=
array_unique
(
$phids
);
}
return
$phids
;
}
}
Event Timeline
Log In to Comment