mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-13 00:56:15 +01:00
92ea07e787
Summary: Ref T9132. Supports selects in stacked actions and adds "Change Status" + "Change Priority". Test Plan: Changed status and priority from stacked actions. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9132 Differential Revision: https://secure.phabricator.com/D14667
62 lines
1.4 KiB
PHP
62 lines
1.4 KiB
PHP
<?php
|
|
|
|
final class PhabricatorSelectEditField
|
|
extends PhabricatorEditField {
|
|
|
|
private $options;
|
|
private $commentActionDefaultValue;
|
|
|
|
public function setOptions(array $options) {
|
|
$this->options = $options;
|
|
return $this;
|
|
}
|
|
|
|
public function getOptions() {
|
|
if ($this->options === null) {
|
|
throw new PhutilInvalidStateException('setOptions');
|
|
}
|
|
return $this->options;
|
|
}
|
|
|
|
public function setCommentActionDefaultValue($default) {
|
|
$this->commentActionDefaultValue = $default;
|
|
return $this;
|
|
}
|
|
|
|
public function getCommentActionDefaultValue() {
|
|
return $this->commentActionDefaultValue;
|
|
}
|
|
|
|
protected function newControl() {
|
|
return id(new AphrontFormSelectControl())
|
|
->setOptions($this->getOptions());
|
|
}
|
|
|
|
protected function newHTTPParameterType() {
|
|
return new AphrontSelectHTTPParameterType();
|
|
}
|
|
|
|
public function getCommentEditTypes() {
|
|
$label = $this->getCommentActionLabel();
|
|
if ($label === null) {
|
|
return array();
|
|
}
|
|
|
|
$default_value = $this->getCommentActionDefaultValue();
|
|
if ($default_value === null) {
|
|
$default_value = $this->getValue();
|
|
}
|
|
|
|
$edit = $this->getEditType()
|
|
->setLabel($label)
|
|
->setPHUIXControlType('select')
|
|
->setPHUIXControlSpecification(
|
|
array(
|
|
'options' => $this->getOptions(),
|
|
'value' => $default_value,
|
|
));
|
|
|
|
return array($edit);
|
|
}
|
|
|
|
}
|