Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2891157
PhabricatorBoolEditField.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorBoolEditField.php
View Options
<?php
final
class
PhabricatorBoolEditField
extends
PhabricatorEditField
{
private
$options
;
private
$asCheckbox
;
public
function
setOptions
(
$off_label
,
$on_label
)
{
$this
->
options
=
array
(
'0'
=>
$off_label
,
'1'
=>
$on_label
,
)
;
return
$this
;
}
public
function
getOptions
(
)
{
return
$this
->
options
;
}
public
function
setAsCheckbox
(
$as_checkbox
)
{
$this
->
asCheckbox
=
$as_checkbox
;
return
$this
;
}
public
function
getAsCheckbox
(
)
{
return
$this
->
asCheckbox
;
}
protected
function
newControl
(
)
{
$options
=
$this
->
getOptions
(
)
;
if
(
!
$options
)
{
$options
=
array
(
'0'
=>
pht
(
'False'
)
,
'1'
=>
pht
(
'True'
)
,
)
;
}
if
(
$this
->
getAsCheckbox
(
)
)
{
$key
=
$this
->
getKey
(
)
;
$value
=
$this
->
getValueForControl
(
)
;
$checkbox_key
=
$this
->
newHTTPParameterType
(
)
->
getCheckboxKey
(
$key
)
;
$id
=
$this
->
getControlID
(
)
;
$control
=
id
(
new
AphrontFormCheckboxControl
(
)
)
->
setCheckboxKey
(
$checkbox_key
)
->
addCheckbox
(
$key
,
'1'
,
$options
[
'1'
]
,
$value
,
$id
)
;
}
else
{
$control
=
id
(
new
AphrontFormSelectControl
(
)
)
->
setOptions
(
$options
)
;
}
return
$control
;
}
protected
function
newHTTPParameterType
(
)
{
return
new
AphrontBoolHTTPParameterType
(
)
;
}
protected
function
newConduitParameterType
(
)
{
return
new
ConduitBoolParameterType
(
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 14:43 (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1125624
Default Alt Text
PhabricatorBoolEditField.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment