@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 recaptime-dev/main 89 lines 2.1 kB view raw
1<?php 2 3final class PhabricatorPackagesPublisherSearchEngine 4 extends PhabricatorApplicationSearchEngine { 5 6 public function getResultTypeDescription() { 7 return pht('Package Publishers'); 8 } 9 10 public function getApplicationClassName() { 11 return PhabricatorPackagesApplication::class; 12 } 13 14 public function newQuery() { 15 return id(new PhabricatorPackagesPublisherQuery()); 16 } 17 18 public function canUseInPanelContext() { 19 return false; 20 } 21 22 protected function buildQueryFromParameters(array $map) { 23 $query = $this->newQuery(); 24 25 if ($map['match'] !== null) { 26 $query->withNameNgrams($map['match']); 27 } 28 29 return $query; 30 } 31 32 protected function buildCustomSearchFields() { 33 return array( 34 id(new PhabricatorSearchTextField()) 35 ->setLabel(pht('Name Contains')) 36 ->setKey('match') 37 ->setDescription(pht('Search for publishers by name substring.')), 38 ); 39 } 40 41 protected function getURI($path) { 42 return '/packages/publisher/'.$path; 43 } 44 45 protected function getBuiltinQueryNames() { 46 $names = array( 47 'all' => pht('All Publishers'), 48 ); 49 50 return $names; 51 } 52 53 public function buildSavedQueryFromBuiltin($query_key) { 54 $query = $this->newSavedQuery(); 55 $query->setQueryKey($query_key); 56 57 switch ($query_key) { 58 case 'all': 59 return $query; 60 } 61 62 return parent::buildSavedQueryFromBuiltin($query_key); 63 } 64 65 /** 66 * @param array<PhabricatorPackagesPublisher> $publishers 67 * @param PhabricatorSavedQuery $query 68 * @param array<PhabricatorObjectHandle> $handles 69 */ 70 protected function renderResultList( 71 array $publishers, 72 PhabricatorSavedQuery $query, 73 array $handles) { 74 75 assert_instances_of($publishers, PhabricatorPackagesPublisher::class); 76 77 $viewer = $this->requireViewer(); 78 79 $list = id(new PhabricatorPackagesPublisherListView()) 80 ->setViewer($viewer) 81 ->setPublishers($publishers) 82 ->newListView(); 83 84 return id(new PhabricatorApplicationSearchResultView()) 85 ->setObjectList($list) 86 ->setNoDataString(pht('No publishers found.')); 87 } 88 89}