@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
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

at recaptime-dev/main 77 lines 2.0 kB view raw
1<?php 2 3final class PhabricatorDashboardQueryPanelQueryEditField 4 extends PhabricatorEditField { 5 6 private $applicationControlID; 7 8 public function setApplicationControlID($id) { 9 $this->applicationControlID = $id; 10 return $this; 11 } 12 13 public function getApplicationControlID() { 14 return $this->applicationControlID; 15 } 16 17 protected function newControl() { 18 $engines = id(new PhutilClassMapQuery()) 19 ->setAncestorClass(PhabricatorApplicationSearchEngine::class) 20 ->setFilterMethod('canUseInPanelContext') 21 ->execute(); 22 23 $value = $this->getValueForControl(); 24 25 $queries = array(); 26 $seen = false; 27 foreach ($engines as $engine_class => $engine) { 28 $engine->setViewer($this->getViewer()); 29 $engine_queries = $engine->loadEnabledNamedQueries(); 30 $query_map = mpull($engine_queries, 'getQueryName', 'getQueryKey'); 31 asort($query_map); 32 33 foreach ($query_map as $key => $name) { 34 $queries[$engine_class][] = array('key' => $key, 'name' => $name); 35 if ($key == $value) { 36 $seen = true; 37 } 38 } 39 } 40 41 if (phutil_nonempty_string($value) && !$seen) { 42 $name = pht('Custom Query ("%s")', $value); 43 } else { 44 $name = pht('(None)'); 45 } 46 47 $options = array($value => $name); 48 49 $application_id = $this->getApplicationControlID(); 50 $control_id = celerity_generate_unique_node_id(); 51 52 Javelin::initBehavior( 53 'dashboard-query-panel-select', 54 array( 55 'applicationID' => $application_id, 56 'queryID' => $control_id, 57 'options' => $queries, 58 'value' => array( 59 'key' => phutil_nonempty_string($value) ? $value : null, 60 'name' => $name, 61 ), 62 )); 63 64 return id(new AphrontFormSelectControl()) 65 ->setID($control_id) 66 ->setOptions($options); 67 } 68 69 protected function newHTTPParameterType() { 70 return new AphrontSelectHTTPParameterType(); 71 } 72 73 protected function newConduitParameterType() { 74 return new ConduitStringParameterType(); 75 } 76 77}