2015-06-07 16:31:28 +02:00
|
|
|
<?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;
|
|
|
|
}
|
|
|
|
|
2015-12-13 12:53:15 +01:00
|
|
|
protected function newConduitParameterType() {
|
|
|
|
return new ConduitStringListParameterType();
|
|
|
|
}
|
|
|
|
|
2015-06-07 16:31:28 +02:00
|
|
|
}
|