1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-03 04:02:43 +01:00
phorge-phorge/src/applications/search/field/PhabricatorSearchCustomFieldProxyField.php
epriestley 663dce5029 Flesh out Conduit parameter types for Owners + CustomFields
Summary:
Ref T9964. Fill in more parameter types and descriptions.

(No date support yet since it's a bit more involved.)

Test Plan: {F1024022}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9964

Differential Revision: https://secure.phabricator.com/D14766
2015-12-14 04:23:44 -08:00

74 lines
1.9 KiB
PHP

<?php
final class PhabricatorSearchCustomFieldProxyField
extends PhabricatorSearchField {
private $searchEngine;
private $customField;
public function setSearchEngine(PhabricatorApplicationSearchEngine $engine) {
$this->searchEngine = $engine;
return $this;
}
public function getSearchEngine() {
return $this->searchEngine;
}
public function setCustomField(PhabricatorCustomField $field) {
$this->customField = $field;
$this->setKey('custom:'.$field->getFieldIndex());
$aliases = array();
$aliases[] = $field->getFieldKey();
$this->setAliases($aliases);
return $this;
}
public function getLabel() {
return $this->getCustomField()->getFieldName();
}
public function getCustomField() {
return $this->customField;
}
protected function getDefaultValue() {
return null;
}
public function getConduitKey() {
return $this->getCustomField()->getModernFieldKey();
}
protected function getValueExistsInRequest(AphrontRequest $request, $key) {
// TODO: For historical reasons, the keys we look for don't line up with
// the keys that CustomFields use. Just skip the check for existence and
// always read the value. It would be vaguely nice to make rendering more
// consistent instead.
return true;
}
protected function getValueFromRequest(AphrontRequest $request, $key) {
return $this->getCustomField()->readApplicationSearchValueFromRequest(
$this->getSearchEngine(),
$request);
}
public function appendToForm(AphrontFormView $form) {
return $this->getCustomField()->appendToApplicationSearchForm(
$this->getSearchEngine(),
$form,
$this->getValue());
}
public function getDescription() {
return $this->getCustomField()->getFieldDescription();
}
protected function newConduitParameterType() {
return $this->getCustomField()->getConduitSearchParameterType();
}
}