Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96623000
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
Sun, Dec 29, 02:48
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Dec 31, 02:48 (2 d)
Engine
blob
Format
Raw Data
Handle
23202982
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
renderFieldValue
(
$value
)
{
$options
=
$this
->
getOptions
();
return
idx
(
$options
,
$value
,
$value
);
}
}
Event Timeline
Log In to Comment