Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / search / field / PhabricatorSearchOrderField.php
blob70b94d1b3596d89b4e334ae86244fbac1bf47529
1 <?php
3 final class PhabricatorSearchOrderField
4 extends PhabricatorSearchField {
6 private $options;
7 private $orderAliases;
9 public function setOrderAliases(array $order_aliases) {
10 $this->orderAliases = $order_aliases;
11 return $this;
14 public function getOrderAliases() {
15 return $this->orderAliases;
18 public function setOptions(array $options) {
19 $this->options = $options;
20 return $this;
23 public function getOptions() {
24 return $this->options;
27 protected function getDefaultValue() {
28 return null;
31 protected function getValueFromRequest(AphrontRequest $request, $key) {
32 return $request->getStr($key);
35 protected function getValueForControl() {
36 // If the SavedQuery has an alias for an order, map it to the canonical
37 // name for the order so the correct option is selected in the dropdown.
38 $value = parent::getValueForControl();
39 if (isset($this->orderAliases[$value])) {
40 $value = $this->orderAliases[$value];
42 return $value;
45 protected function newControl() {
46 return id(new AphrontFormSelectControl())
47 ->setOptions($this->getOptions());