Changeset View
Changeset View
Standalone View
Standalone View
src/applications/search/field/PhabricatorSearchField.php
Show All 11 Lines | abstract class PhabricatorSearchField extends Phobject { | ||||
private $key; | private $key; | ||||
private $conduitKey; | private $conduitKey; | ||||
private $viewer; | private $viewer; | ||||
private $value; | private $value; | ||||
private $label; | private $label; | ||||
private $aliases = array(); | private $aliases = array(); | ||||
private $errors = array(); | private $errors = array(); | ||||
private $description; | private $description; | ||||
private $isHidden; | |||||
/* -( Configuring Fields )------------------------------------------------- */ | /* -( Configuring Fields )------------------------------------------------- */ | ||||
/** | /** | ||||
* Set the primary key for the field, like `projectPHIDs`. | * Set the primary key for the field, like `projectPHIDs`. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 155 Lines • ▼ Show 20 Lines | /* -( Configuring Fields )------------------------------------------------- */ | ||||
* @return string|null Human-readable description. | * @return string|null Human-readable description. | ||||
* @task config | * @task config | ||||
*/ | */ | ||||
public function getDescription() { | public function getDescription() { | ||||
return $this->description; | return $this->description; | ||||
} | } | ||||
/** | |||||
* Hide this field from the web UI. | |||||
* | |||||
* @param bool True to hide the field from the web UI. | |||||
* @return this | |||||
* @task config | |||||
*/ | |||||
public function setIsHidden($is_hidden) { | |||||
$this->isHidden = $is_hidden; | |||||
return $this; | |||||
} | |||||
/** | |||||
* Should this field be hidden from the web UI? | |||||
* | |||||
* @return bool True to hide the field in the web UI. | |||||
* @task config | |||||
*/ | |||||
public function getIsHidden() { | |||||
return $this->isHidden; | |||||
} | |||||
/* -( Handling Errors )---------------------------------------------------- */ | /* -( Handling Errors )---------------------------------------------------- */ | ||||
protected function addError($short, $long) { | protected function addError($short, $long) { | ||||
$this->errors[] = array($short, $long); | $this->errors[] = array($short, $long); | ||||
return $this; | return $this; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | /* -( Rendering Controls )------------------------------------------------- */ | ||||
protected function newControl() { | protected function newControl() { | ||||
throw new PhutilMethodNotImplementedException(); | throw new PhutilMethodNotImplementedException(); | ||||
} | } | ||||
protected function renderControl() { | protected function renderControl() { | ||||
if ($this->getIsHidden()) { | |||||
return null; | |||||
} | |||||
$control = $this->newControl(); | $control = $this->newControl(); | ||||
if (!$control) { | if (!$control) { | ||||
return null; | return null; | ||||
} | } | ||||
// TODO: We should `setError($this->getShortError())` here, but it looks | // TODO: We should `setError($this->getShortError())` here, but it looks | ||||
// terrible in the form layout. | // terrible in the form layout. | ||||
▲ Show 20 Lines • Show All 95 Lines • Show Last 20 Lines |