Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93571497
HeraldSelectFieldValue.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, Nov 29, 20:18
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Dec 1, 20:18 (2 d)
Engine
blob
Format
Raw Data
Handle
22667863
Attached To
rPH Phabricator
HeraldSelectFieldValue.php
View Options
<?php
final
class
HeraldSelectFieldValue
extends
HeraldFieldValue
{
private
$key
;
private
$options
;
private
$default
;
public
function
setKey
(
$key
)
{
$this
->
key
=
$key
;
return
$this
;
}
public
function
getKey
()
{
return
$this
->
key
;
}
public
function
setOptions
(
array
$options
)
{
$this
->
options
=
$options
;
return
$this
;
}
public
function
getOptions
()
{
return
$this
->
options
;
}
public
function
setDefault
(
$default
)
{
$this
->
default
=
$default
;
return
$this
;
}
public
function
getDefault
()
{
return
$this
->
default
;
}
public
function
getFieldValueKey
()
{
if
(
$this
->
getKey
()
===
null
)
{
throw
new
PhutilInvalidStateException
(
'setKey'
);
}
return
'select.'
.
$this
->
getKey
();
}
public
function
getControlType
()
{
return
self
::
CONTROL_SELECT
;
}
protected
function
getControlTemplate
()
{
if
(
$this
->
getOptions
()
===
null
)
{
throw
new
PhutilInvalidStateException
(
'setOptions'
);
}
return
array
(
'options'
=>
$this
->
getOptions
(),
'default'
=>
$this
->
getDefault
(),
);
}
public
function
renderValue
(
PhabricatorUser
$viewer
,
$value
)
{
$options
=
$this
->
getOptions
();
return
idx
(
$options
,
$value
,
$value
);
}
}
Event Timeline
Log In to Comment