mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-30 05:58:12 +02:00
Summary: Fixes T12851. This should fix the error I'm seeing, which is: * `Argument 1 passed to array_fuse() must be of the type array, boolean given` There may be a better way to patch this up than overriding the getValue() method, however. Test Plan: - Changed the default "Tags" filter to specify `true` instead of `array('self')`, then viewed that filter in the UI. - Before patch: fatal. - After patch: page loads. Note that `true` is not interpreted as `array('self')`, but the page isn't broken, which is a big improvement. Reviewers: #blessed_reviewers, 20after4, chad, amckinley Reviewed By: #blessed_reviewers, amckinley Subscribers: Korvin Maniphest Tasks: T12851 Differential Revision: https://secure.phabricator.com/D18132
52 lines
1 KiB
PHP
52 lines
1 KiB
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 didReadValueFromSavedQuery($value) {
|
|
if (!is_array($value)) {
|
|
return array();
|
|
}
|
|
|
|
return $value;
|
|
}
|
|
|
|
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();
|
|
}
|
|
|
|
}
|