Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97260876
PhabricatorSearchCheckboxesField.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
Fri, Jan 3, 21:06
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Jan 5, 21:06 (2 d)
Engine
blob
Format
Raw Data
Handle
23367848
Attached To
rPH Phabricator
PhabricatorSearchCheckboxesField.php
View Options
<?php
final
class
PhabricatorSearchCheckboxesField
extends
PhabricatorSearchField
{
private
$options
;
public
function
setOptions
(
array
$options
)
{
$this
->
options
=
$options
;
return
$this
;
}
public
function
getOptions
()
{
return
$this
->
options
;
}
protected
function
getDefaultValue
()
{
return
array
();
}
protected
function
didReadValueFromSavedQuery
(
$value
)
{
if
(!
is_array
(
$value
))
{
return
array
();
}
return
$value
;
}
protected
function
getValueFromRequest
(
AphrontRequest
$request
,
$key
)
{
return
$this
->
getListFromRequest
(
$request
,
$key
);
}
protected
function
newControl
()
{
$value
=
array_fuse
(
$this
->
getValue
());
$control
=
new
AphrontFormCheckboxControl
();
foreach
(
$this
->
getOptions
()
as
$key
=>
$option
)
{
$control
->
addCheckbox
(
$this
->
getKey
().
'[]'
,
$key
,
$option
,
isset
(
$value
[
$key
]));
}
return
$control
;
}
protected
function
newConduitParameterType
()
{
return
new
ConduitStringListParameterType
();
}
public
function
newConduitConstants
()
{
$list
=
array
();
foreach
(
$this
->
getOptions
()
as
$key
=>
$option
)
{
$list
[]
=
id
(
new
ConduitConstantDescription
())
->
setKey
(
$key
)
->
setValue
(
$option
);
}
return
$list
;
}
}
Event Timeline
Log In to Comment