Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/dashboard/editfield/PhabricatorDashboardQueryPanelApplicationEditField.php
13450 views
1
<?php
2
3
final class PhabricatorDashboardQueryPanelApplicationEditField
4
extends PhabricatorEditField {
5
6
private $controlID;
7
8
protected function newControl() {
9
$engines = id(new PhutilClassMapQuery())
10
->setAncestorClass('PhabricatorApplicationSearchEngine')
11
->setFilterMethod('canUseInPanelContext')
12
->execute();
13
14
$all_apps = id(new PhabricatorApplicationQuery())
15
->setViewer($this->getViewer())
16
->withUnlisted(false)
17
->withInstalled(true)
18
->execute();
19
foreach ($engines as $index => $engine) {
20
if (!isset($all_apps[$engine->getApplicationClassName()])) {
21
unset($engines[$index]);
22
continue;
23
}
24
}
25
26
$options = array();
27
28
$value = $this->getValueForControl();
29
if (strlen($value) && empty($engines[$value])) {
30
$options[$value] = $value;
31
}
32
33
$engines = msort($engines, 'getResultTypeDescription');
34
foreach ($engines as $class_name => $engine) {
35
$options[$class_name] = $engine->getResultTypeDescription();
36
}
37
38
return id(new AphrontFormSelectControl())
39
->setID($this->getControlID())
40
->setOptions($options);
41
}
42
43
protected function newHTTPParameterType() {
44
return new AphrontSelectHTTPParameterType();
45
}
46
47
public function getControlID() {
48
if (!$this->controlID) {
49
$this->controlID = celerity_generate_unique_node_id();
50
}
51
52
return $this->controlID;
53
}
54
55
protected function newConduitParameterType() {
56
return new ConduitStringParameterType();
57
}
58
59
}
60
61