@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorStandardCustomFieldText
4 extends PhabricatorStandardCustomField {
5
6 public function getFieldType() {
7 return 'text';
8 }
9
10 public function buildFieldIndexes() {
11 $indexes = array();
12
13 $value = $this->getFieldValue();
14 if (phutil_nonempty_string($value)) {
15 $indexes[] = $this->newStringIndex($value);
16 }
17
18 return $indexes;
19 }
20
21 public function readApplicationSearchValueFromRequest(
22 PhabricatorApplicationSearchEngine $engine,
23 AphrontRequest $request) {
24
25 return $request->getStr($this->getFieldKey());
26 }
27
28 public function applyApplicationSearchConstraintToQuery(
29 PhabricatorApplicationSearchEngine $engine,
30 PhabricatorCursorPagedPolicyAwareQuery $query,
31 $value) {
32
33 if (phutil_nonempty_string($value)) {
34 $query->withApplicationSearchContainsConstraint(
35 $this->newStringIndex(null),
36 $value);
37 }
38 }
39
40 public function appendToApplicationSearchForm(
41 PhabricatorApplicationSearchEngine $engine,
42 AphrontFormView $form,
43 $value) {
44
45 $form->appendChild(
46 id(new AphrontFormTextControl())
47 ->setLabel($this->getFieldName())
48 ->setName($this->getFieldKey())
49 ->setValue($value));
50 }
51
52 public function shouldAppearInHerald() {
53 return true;
54 }
55
56 public function getHeraldFieldConditions() {
57 return array(
58 HeraldAdapter::CONDITION_CONTAINS,
59 HeraldAdapter::CONDITION_NOT_CONTAINS,
60 HeraldAdapter::CONDITION_IS,
61 HeraldAdapter::CONDITION_IS_NOT,
62 HeraldAdapter::CONDITION_REGEXP,
63 HeraldAdapter::CONDITION_NOT_REGEXP,
64 );
65 }
66
67 public function getHeraldFieldStandardType() {
68 return HeraldField::STANDARD_TEXT;
69 }
70
71 protected function getHTTPParameterType() {
72 return new AphrontStringHTTPParameterType();
73 }
74
75 public function getConduitEditParameterType() {
76 return new ConduitStringParameterType();
77 }
78
79 protected function newExportFieldType() {
80 return new PhabricatorStringExportField();
81 }
82
83}