@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorProjectSearchField
4 extends PhabricatorSearchTokenizerField {
5
6 protected function getDefaultValue() {
7 return array();
8 }
9
10 protected function newDatasource() {
11 return new PhabricatorProjectLogicalDatasource();
12 }
13
14 protected function getValueFromRequest(AphrontRequest $request, $key) {
15 $list = $this->getListFromRequest($request, $key);
16
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;
31 }
32 }
33 }
34
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();
42 }
43 $phids = array_unique($phids);
44 }
45
46 return $phids;
47
48 }
49
50 protected function newConduitParameterType() {
51 return new ConduitProjectListParameterType();
52 }
53
54}