2016-04-27 01:02:57 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorBoolEditField
|
|
|
|
extends PhabricatorEditField {
|
|
|
|
|
2016-04-28 00:40:35 +02:00
|
|
|
private $options;
|
|
|
|
|
|
|
|
public function setOptions($off_label, $on_label) {
|
|
|
|
$this->options = array(
|
|
|
|
'0' => $off_label,
|
|
|
|
'1' => $on_label,
|
|
|
|
);
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getOptions() {
|
|
|
|
return $this->options;
|
|
|
|
}
|
|
|
|
|
2016-04-27 01:02:57 +02:00
|
|
|
protected function newControl() {
|
2016-04-28 00:40:35 +02:00
|
|
|
$options = $this->getOptions();
|
|
|
|
|
|
|
|
if (!$options) {
|
|
|
|
$options = array(
|
|
|
|
'0' => pht('False'),
|
|
|
|
'1' => pht('True'),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2016-04-27 01:02:57 +02:00
|
|
|
return id(new AphrontFormSelectControl())
|
2016-04-28 00:40:35 +02:00
|
|
|
->setOptions($options);
|
2016-04-27 01:02:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected function newHTTPParameterType() {
|
|
|
|
return new AphrontBoolHTTPParameterType();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function newConduitParameterType() {
|
|
|
|
return new ConduitBoolParameterType();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|