Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2890730
PhabricatorDashboardQueryPanelQueryEditField.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorDashboardQueryPanelQueryEditField.php
View Options
<?php
final
class
PhabricatorDashboardQueryPanelQueryEditField
extends
PhabricatorEditField
{
private
$applicationControlID
;
public
function
setApplicationControlID
(
$id
)
{
$this
->
applicationControlID
=
$id
;
return
$this
;
}
public
function
getApplicationControlID
(
)
{
return
$this
->
applicationControlID
;
}
protected
function
newControl
(
)
{
$engines
=
id
(
new
PhutilClassMapQuery
(
)
)
->
setAncestorClass
(
'PhabricatorApplicationSearchEngine'
)
->
setFilterMethod
(
'canUseInPanelContext'
)
->
execute
(
)
;
$value
=
$this
->
getValueForControl
(
)
;
$queries
=
array
(
)
;
$seen
=
false
;
foreach
(
$engines
as
$engine_class
=>
$engine
)
{
$engine
->
setViewer
(
$this
->
getViewer
(
)
)
;
$engine_queries
=
$engine
->
loadEnabledNamedQueries
(
)
;
$query_map
=
mpull
(
$engine_queries
,
'getQueryName'
,
'getQueryKey'
)
;
asort
(
$query_map
)
;
foreach
(
$query_map
as
$key
=>
$name
)
{
$queries
[
$engine_class
]
[
]
=
array
(
'key'
=>
$key
,
'name'
=>
$name
)
;
if
(
$key
==
$value
)
{
$seen
=
true
;
}
}
}
if
(
phutil_nonempty_string
(
$value
)
&&
!
$seen
)
{
$name
=
pht
(
'Custom Query ("%s")'
,
$value
)
;
}
else
{
$name
=
pht
(
'(None)'
)
;
}
$options
=
array
(
$value
=>
$name
)
;
$application_id
=
$this
->
getApplicationControlID
(
)
;
$control_id
=
celerity_generate_unique_node_id
(
)
;
Javelin
::
initBehavior
(
'dashboard-query-panel-select'
,
array
(
'applicationID'
=>
$application_id
,
'queryID'
=>
$control_id
,
'options'
=>
$queries
,
'value'
=>
array
(
'key'
=>
phutil_nonempty_string
(
$value
)
?
$value
:
null
,
'name'
=>
$name
,
)
,
)
)
;
return
id
(
new
AphrontFormSelectControl
(
)
)
->
setID
(
$control_id
)
->
setOptions
(
$options
)
;
}
protected
function
newHTTPParameterType
(
)
{
return
new
AphrontSelectHTTPParameterType
(
)
;
}
protected
function
newConduitParameterType
(
)
{
return
new
ConduitStringParameterType
(
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 14:00 (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1118350
Default Alt Text
PhabricatorDashboardQueryPanelQueryEditField.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment