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

Configure Feed

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

at upstream/main 103 lines 2.3 kB view raw
1<?php 2 3final class NuanceItemSearchEngine 4 extends PhabricatorApplicationSearchEngine { 5 6 public function getApplicationClassName() { 7 return PhabricatorNuanceApplication::class; 8 } 9 10 public function getResultTypeDescription() { 11 return pht('Nuance Items'); 12 } 13 14 public function newQuery() { 15 return new NuanceItemQuery(); 16 } 17 18 protected function buildQueryFromParameters(array $map) { 19 $query = $this->newQuery(); 20 21 return $query; 22 } 23 24 protected function buildCustomSearchFields() { 25 return array( 26 ); 27 } 28 29 protected function getURI($path) { 30 return '/nuance/item/'.$path; 31 } 32 33 protected function getBuiltinQueryNames() { 34 $names = array( 35 'all' => pht('All Items'), 36 ); 37 38 return $names; 39 } 40 41 public function buildSavedQueryFromBuiltin($query_key) { 42 $query = $this->newSavedQuery(); 43 $query->setQueryKey($query_key); 44 45 switch ($query_key) { 46 case 'all': 47 return $query; 48 } 49 50 return parent::buildSavedQueryFromBuiltin($query_key); 51 } 52 53 /** 54 * @param array<NuanceItem> $items 55 * @param PhabricatorSavedQuery $query 56 * @param array<PhabricatorObjectHandle> $handles 57 */ 58 protected function renderResultList( 59 array $items, 60 PhabricatorSavedQuery $query, 61 array $handles) { 62 assert_instances_of($items, NuanceItem::class); 63 64 $viewer = $this->requireViewer(); 65 66 $list = new PHUIObjectItemListView(); 67 $list->setUser($viewer); 68 foreach ($items as $item) { 69 $impl = $item->getImplementation(); 70 71 $view = id(new PHUIObjectItemView()) 72 ->setObjectName(pht('Item %d', $item->getID())) 73 ->setHeader($item->getDisplayName()) 74 ->setHref($item->getURI()); 75 76 $view->addIcon( 77 $impl->getItemTypeDisplayIcon(), 78 $impl->getItemTypeDisplayName()); 79 80 $queue = $item->getQueue(); 81 if ($queue) { 82 $view->addAttribute( 83 phutil_tag( 84 'a', 85 array( 86 'href' => $queue->getURI(), 87 ), 88 $queue->getName())); 89 } else { 90 $view->addAttribute(phutil_tag('em', array(), pht('Not in Queue'))); 91 } 92 93 $list->addItem($view); 94 } 95 96 $result = new PhabricatorApplicationSearchResultView(); 97 $result->setObjectList($list); 98 $result->setNoDataString(pht('No items found.')); 99 100 return $result; 101 } 102 103}