Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F104620036
PhabricatorStandardCustomFieldSelect.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, Mar 10, 23:17
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Mar 12, 23:17 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24824194
Attached To
rPH Phabricator
PhabricatorStandardCustomFieldSelect.php
View Options
<?php
final
class
PhabricatorStandardCustomFieldSelect
extends
PhabricatorStandardCustomField
{
public
function
getFieldType
()
{
return
'select'
;
}
public
function
buildFieldIndexes
()
{
$indexes
=
array
();
$value
=
$this
->
getFieldValue
();
if
(
strlen
(
$value
))
{
$indexes
[]
=
$this
->
newStringIndex
(
$value
);
}
return
$indexes
;
}
public
function
readApplicationSearchValueFromRequest
(
PhabricatorApplicationSearchEngine
$engine
,
AphrontRequest
$request
)
{
return
$request
->
getArr
(
$this
->
getFieldKey
());
}
public
function
applyApplicationSearchConstraintToQuery
(
PhabricatorApplicationSearchEngine
$engine
,
PhabricatorCursorPagedPolicyAwareQuery
$query
,
$value
)
{
if
(
$value
)
{
$query
->
withApplicationSearchContainsConstraint
(
$this
->
newStringIndex
(
null
),
$value
);
}
}
public
function
appendToApplicationSearchForm
(
PhabricatorApplicationSearchEngine
$engine
,
AphrontFormView
$form
,
$value
,
array
$handles
)
{
if
(!
is_array
(
$value
))
{
$value
=
array
();
}
$value
=
array_fuse
(
$value
);
$control
=
id
(
new
AphrontFormCheckboxControl
())
->
setLabel
(
$this
->
getFieldName
());
foreach
(
$this
->
getOptions
()
as
$name
=>
$option
)
{
$control
->
addCheckbox
(
$this
->
getFieldKey
().
'[]'
,
$name
,
$option
,
isset
(
$value
[
$name
]));
}
$form
->
appendChild
(
$control
);
}
private
function
getOptions
()
{
return
$this
->
getFieldConfigValue
(
'options'
,
array
());
}
public
function
renderEditControl
()
{
return
id
(
new
AphrontFormSelectControl
())
->
setLabel
(
$this
->
getFieldName
())
->
setCaption
(
$this
->
getCaption
())
->
setName
(
$this
->
getFieldKey
())
->
setValue
(
$this
->
getFieldValue
())
->
setOptions
(
$this
->
getOptions
());
}
public
function
renderPropertyViewValue
()
{
return
idx
(
$this
->
getOptions
(),
$this
->
getFieldValue
());
}
}
Event Timeline
Log In to Comment