mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-16 11:52:40 +01:00
05a798e3ac
Summary: Ref T9964. I want to show users what we're expecting in "constraints", and let constraints like "authors=epriestley" work to make things easier. I'm generally very happy with the "HTTPParameterType" stuff from EditEngine, so add a parallel set of "ConduitParameterType" classes. These are a little simpler than the HTTP ones, but have a little more validation logic. Test Plan: This is really just a proof of concept; some of these fields are now filled in: {F1023845} Reviewers: chad Reviewed By: chad Maniphest Tasks: T9964 Differential Revision: https://secure.phabricator.com/D14763
44 lines
917 B
PHP
44 lines
917 B
PHP
<?php
|
|
|
|
final class PhabricatorSearchCheckboxesField
|
|
extends PhabricatorSearchField {
|
|
|
|
private $options;
|
|
|
|
public function setOptions(array $options) {
|
|
$this->options = $options;
|
|
return $this;
|
|
}
|
|
|
|
public function getOptions() {
|
|
return $this->options;
|
|
}
|
|
|
|
protected function getDefaultValue() {
|
|
return array();
|
|
}
|
|
|
|
protected function getValueFromRequest(AphrontRequest $request, $key) {
|
|
return $this->getListFromRequest($request, $key);
|
|
}
|
|
|
|
protected function newControl() {
|
|
$value = array_fuse($this->getValue());
|
|
|
|
$control = new AphrontFormCheckboxControl();
|
|
foreach ($this->getOptions() as $key => $option) {
|
|
$control->addCheckbox(
|
|
$this->getKey().'[]',
|
|
$key,
|
|
$option,
|
|
isset($value[$key]));
|
|
}
|
|
|
|
return $control;
|
|
}
|
|
|
|
protected function newConduitParameterType() {
|
|
return new ConduitStringListParameterType();
|
|
}
|
|
|
|
}
|