mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-28 14:39:36 +01:00
Summary: Ref T10512. This is fairly bare-bones but appears to work. Test Plan: Queried all users, queried some stuff by constraints. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10512 Differential Revision: https://secure.phabricator.com/D15959
52 lines
1 KiB
PHP
52 lines
1 KiB
PHP
<?php
|
|
|
|
final class PhabricatorSearchThreeStateField
|
|
extends PhabricatorSearchField {
|
|
|
|
private $options;
|
|
|
|
public function setOptions($null, $yes, $no) {
|
|
$this->options = array(
|
|
'' => $null,
|
|
'true' => $yes,
|
|
'false' => $no,
|
|
);
|
|
return $this;
|
|
}
|
|
|
|
public function getOptions() {
|
|
return $this->options;
|
|
}
|
|
|
|
protected function getDefaultValue() {
|
|
return null;
|
|
}
|
|
|
|
protected function getValueFromRequest(AphrontRequest $request, $key) {
|
|
if (!strlen($request->getStr($key))) {
|
|
return null;
|
|
}
|
|
return $request->getBool($key);
|
|
}
|
|
|
|
protected function newControl() {
|
|
return id(new AphrontFormSelectControl())
|
|
->setOptions($this->getOptions());
|
|
}
|
|
|
|
protected function getValueForControl() {
|
|
$value = parent::getValueForControl();
|
|
if ($value === true) {
|
|
return 'true';
|
|
}
|
|
if ($value === false) {
|
|
return 'false';
|
|
}
|
|
return null;
|
|
}
|
|
|
|
protected function newConduitParameterType() {
|
|
return new ConduitBoolParameterType();
|
|
}
|
|
|
|
}
|