Path: blob/master/src/applications/dashboard/editfield/PhabricatorDashboardQueryPanelApplicationEditField.php
13450 views
<?php12final class PhabricatorDashboardQueryPanelApplicationEditField3extends PhabricatorEditField {45private $controlID;67protected function newControl() {8$engines = id(new PhutilClassMapQuery())9->setAncestorClass('PhabricatorApplicationSearchEngine')10->setFilterMethod('canUseInPanelContext')11->execute();1213$all_apps = id(new PhabricatorApplicationQuery())14->setViewer($this->getViewer())15->withUnlisted(false)16->withInstalled(true)17->execute();18foreach ($engines as $index => $engine) {19if (!isset($all_apps[$engine->getApplicationClassName()])) {20unset($engines[$index]);21continue;22}23}2425$options = array();2627$value = $this->getValueForControl();28if (strlen($value) && empty($engines[$value])) {29$options[$value] = $value;30}3132$engines = msort($engines, 'getResultTypeDescription');33foreach ($engines as $class_name => $engine) {34$options[$class_name] = $engine->getResultTypeDescription();35}3637return id(new AphrontFormSelectControl())38->setID($this->getControlID())39->setOptions($options);40}4142protected function newHTTPParameterType() {43return new AphrontSelectHTTPParameterType();44}4546public function getControlID() {47if (!$this->controlID) {48$this->controlID = celerity_generate_unique_node_id();49}5051return $this->controlID;52}5354protected function newConduitParameterType() {55return new ConduitStringParameterType();56}5758}596061