3 final class PhabricatorStandardCustomFieldBool
4 extends PhabricatorStandardCustomField
{
6 public function getFieldType() {
10 public function buildFieldIndexes() {
13 $value = $this->getFieldValue();
15 $indexes[] = $this->newNumericIndex((int)$value);
21 public function buildOrderIndex() {
22 return $this->newNumericIndex(0);
25 public function readValueFromRequest(AphrontRequest
$request) {
26 $this->setFieldValue((bool)$request->getBool($this->getFieldKey()));
29 public function getValueForStorage() {
30 $value = $this->getFieldValue();
31 if ($value !== null) {
38 public function setValueFromStorage($value) {
40 $value = (bool)$value;
44 return $this->setFieldValue($value);
47 public function readApplicationSearchValueFromRequest(
48 PhabricatorApplicationSearchEngine
$engine,
49 AphrontRequest
$request) {
51 return $request->getStr($this->getFieldKey());
54 public function applyApplicationSearchConstraintToQuery(
55 PhabricatorApplicationSearchEngine
$engine,
56 PhabricatorCursorPagedPolicyAwareQuery
$query,
58 if ($value == 'require') {
59 $query->withApplicationSearchContainsConstraint(
60 $this->newNumericIndex(null),
65 public function appendToApplicationSearchForm(
66 PhabricatorApplicationSearchEngine
$engine,
67 AphrontFormView
$form,
71 id(new AphrontFormSelectControl())
72 ->setLabel($this->getFieldName())
73 ->setName($this->getFieldKey())
77 '' => $this->getString('search.default', pht('(Any)')),
78 'require' => $this->getString('search.require', pht('Require')),
82 public function renderEditControl(array $handles) {
83 return id(new AphrontFormCheckboxControl())
84 ->setLabel($this->getFieldName())
85 ->setCaption($this->getCaption())
89 $this->getString('edit.checkbox'),
90 (bool)$this->getFieldValue());
93 public function renderPropertyViewValue(array $handles) {
94 $value = $this->getFieldValue();
96 return $this->getString('view.yes', pht('Yes'));
102 public function getApplicationTransactionTitle(
103 PhabricatorApplicationTransaction
$xaction) {
104 $author_phid = $xaction->getAuthorPHID();
105 $old = $xaction->getOldValue();
106 $new = $xaction->getNewValue();
111 $xaction->renderHandleLink($author_phid),
112 $this->getFieldName());
116 $xaction->renderHandleLink($author_phid),
117 $this->getFieldName());
121 public function shouldAppearInHerald() {
125 public function getHeraldFieldConditions() {
127 HeraldAdapter
::CONDITION_IS_TRUE
,
128 HeraldAdapter
::CONDITION_IS_FALSE
,
132 public function getHeraldFieldStandardType() {
133 return HeraldField
::STANDARD_BOOL
;
136 protected function getHTTPParameterType() {
137 return new AphrontBoolHTTPParameterType();
140 protected function newConduitSearchParameterType() {
141 return new ConduitBoolParameterType();
144 protected function newConduitEditParameterType() {
145 return new ConduitBoolParameterType();