Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99371469
PhabricatorSelectEditField.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
Thu, Jan 23, 23:04
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Jan 25, 23:04 (2 d)
Engine
blob
Format
Raw Data
Handle
23788041
Attached To
rPH Phabricator
PhabricatorSelectEditField.php
View Options
<?php
final
class
PhabricatorSelectEditField
extends
PhabricatorEditField
{
private
$options
;
private
$optionAliases
=
array
();
public
function
setOptions
(
array
$options
)
{
$this
->
options
=
$options
;
return
$this
;
}
public
function
getOptions
()
{
if
(
$this
->
options
===
null
)
{
throw
new
PhutilInvalidStateException
(
'setOptions'
);
}
return
$this
->
options
;
}
public
function
setOptionAliases
(
array
$option_aliases
)
{
$this
->
optionAliases
=
$option_aliases
;
return
$this
;
}
public
function
getOptionAliases
()
{
return
$this
->
optionAliases
;
}
protected
function
getDefaultValueFromConfiguration
(
$value
)
{
return
$this
->
getCanonicalValue
(
$value
);
}
protected
function
getValueForControl
()
{
$value
=
parent
::
getValueForControl
();
return
$this
->
getCanonicalValue
(
$value
);
}
protected
function
newControl
()
{
return
id
(
new
AphrontFormSelectControl
())
->
setOptions
(
$this
->
getOptions
());
}
protected
function
newHTTPParameterType
()
{
return
new
AphrontSelectHTTPParameterType
();
}
protected
function
newCommentAction
()
{
return
id
(
new
PhabricatorEditEngineSelectCommentAction
())
->
setOptions
(
$this
->
getOptions
());
}
protected
function
newConduitParameterType
()
{
return
new
ConduitStringParameterType
();
}
protected
function
newBulkParameterType
()
{
return
id
(
new
BulkSelectParameterType
())
->
setOptions
(
$this
->
getOptions
());
}
private
function
getCanonicalValue
(
$value
)
{
$options
=
$this
->
getOptions
();
if
(!
isset
(
$options
[
$value
]))
{
$aliases
=
$this
->
getOptionAliases
();
if
(
isset
(
$aliases
[
$value
]))
{
$value
=
$aliases
[
$value
];
}
}
return
$value
;
}
}
Event Timeline
Log In to Comment