Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / project / searchfield / PhabricatorProjectSearchField.php
blob8b81cb9d15d92edbb42029156f136da62e88ea66
1 <?php
3 final class PhabricatorProjectSearchField
4 extends PhabricatorSearchTokenizerField {
6 protected function getDefaultValue() {
7 return array();
10 protected function newDatasource() {
11 return new PhabricatorProjectLogicalDatasource();
14 protected function getValueFromRequest(AphrontRequest $request, $key) {
15 $list = $this->getListFromRequest($request, $key);
17 $phids = array();
18 $slugs = array();
19 $project_type = PhabricatorProjectProjectPHIDType::TYPECONST;
20 foreach ($list as $item) {
21 $type = phid_get_type($item);
22 if ($type == $project_type) {
23 $phids[] = $item;
24 } else {
25 if (PhabricatorTypeaheadDatasource::isFunctionToken($item)) {
26 // If this is a function, pass it through unchanged; we'll evaluate
27 // it later.
28 $phids[] = $item;
29 } else {
30 $slugs[] = $item;
35 if ($slugs) {
36 $projects = id(new PhabricatorProjectQuery())
37 ->setViewer($this->getViewer())
38 ->withSlugs($slugs)
39 ->execute();
40 foreach ($projects as $project) {
41 $phids[] = $project->getPHID();
43 $phids = array_unique($phids);
46 return $phids;
50 protected function newConduitParameterType() {
51 return new ConduitProjectListParameterType();