Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / search / field / PhabricatorSearchCustomFieldProxyField.php
blob58d50a245e9a31b5f3b906a2cb5602c986616fee
1 <?php
3 final class PhabricatorSearchCustomFieldProxyField
4 extends PhabricatorSearchField {
6 private $searchEngine;
7 private $customField;
9 public function setSearchEngine(PhabricatorApplicationSearchEngine $engine) {
10 $this->searchEngine = $engine;
11 return $this;
14 public function getSearchEngine() {
15 return $this->searchEngine;
18 public function setCustomField(PhabricatorCustomField $field) {
19 $this->customField = $field;
20 $this->setKey('custom:'.$field->getFieldIndex());
22 $aliases = array();
23 $aliases[] = $field->getFieldKey();
24 $this->setAliases($aliases);
26 return $this;
29 public function getLabel() {
30 return $this->getCustomField()->getFieldName();
33 public function getCustomField() {
34 return $this->customField;
37 protected function getDefaultValue() {
38 return null;
41 public function getConduitKey() {
42 return $this->getCustomField()->getModernFieldKey();
45 protected function getValueExistsInRequest(AphrontRequest $request, $key) {
46 // TODO: For historical reasons, the keys we look for don't line up with
47 // the keys that CustomFields use. Just skip the check for existence and
48 // always read the value. It would be vaguely nice to make rendering more
49 // consistent instead.
50 return true;
53 protected function getValueFromRequest(AphrontRequest $request, $key) {
54 return $this->getCustomField()->readApplicationSearchValueFromRequest(
55 $this->getSearchEngine(),
56 $request);
59 public function appendToForm(AphrontFormView $form) {
60 return $this->getCustomField()->appendToApplicationSearchForm(
61 $this->getSearchEngine(),
62 $form,
63 $this->getValue());
66 public function getDescription() {
67 return $this->getCustomField()->getFieldDescription();
70 protected function newConduitParameterType() {
71 return $this->getCustomField()->getConduitSearchParameterType();