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

Add a basic icon typeahead

Summary: Fixes T11971, adds a basic typeahead for selecting an icon.

Test Plan:
http://local.phacility.com/typeahead/browse/PhabricatorIconDatasource/

{F2561013}

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T11971

Differential Revision: https://secure.phabricator.com/D17301

+48
+2
src/__phutil_library_map__.php
··· 2848 2848 'PhabricatorIDsSearchEngineExtension' => 'applications/search/engineextension/PhabricatorIDsSearchEngineExtension.php', 2849 2849 'PhabricatorIDsSearchField' => 'applications/search/field/PhabricatorIDsSearchField.php', 2850 2850 'PhabricatorIRCProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorIRCProtocolAdapter.php', 2851 + 'PhabricatorIconDatasource' => 'applications/files/typeahead/PhabricatorIconDatasource.php', 2851 2852 'PhabricatorIconRemarkupRule' => 'applications/macro/markup/PhabricatorIconRemarkupRule.php', 2852 2853 'PhabricatorIconSet' => 'applications/files/iconset/PhabricatorIconSet.php', 2853 2854 'PhabricatorIconSetEditField' => 'applications/transactions/editfield/PhabricatorIconSetEditField.php', ··· 7907 7908 'PhabricatorIDsSearchEngineExtension' => 'PhabricatorSearchEngineExtension', 7908 7909 'PhabricatorIDsSearchField' => 'PhabricatorSearchField', 7909 7910 'PhabricatorIRCProtocolAdapter' => 'PhabricatorProtocolAdapter', 7911 + 'PhabricatorIconDatasource' => 'PhabricatorTypeaheadDatasource', 7910 7912 'PhabricatorIconRemarkupRule' => 'PhutilRemarkupRule', 7911 7913 'PhabricatorIconSet' => 'Phobject', 7912 7914 'PhabricatorIconSetEditField' => 'PhabricatorEditField',
+46
src/applications/files/typeahead/PhabricatorIconDatasource.php
··· 1 + <?php 2 + 3 + final class PhabricatorIconDatasource extends PhabricatorTypeaheadDatasource { 4 + 5 + public function getPlaceholderText() { 6 + return pht('Type an icon name...'); 7 + } 8 + 9 + public function getBrowseTitle() { 10 + return pht('Browse Icons'); 11 + } 12 + 13 + public function getDatasourceApplicationClass() { 14 + return 'PhabricatorFilesApplication'; 15 + } 16 + 17 + public function loadResults() { 18 + $results = $this->buildResults(); 19 + return $this->filterResultsAgainstTokens($results); 20 + } 21 + 22 + protected function renderSpecialTokens(array $values) { 23 + return $this->renderTokensFromResults($this->buildResults(), $values); 24 + } 25 + 26 + private function buildResults() { 27 + $raw_query = $this->getRawQuery(); 28 + 29 + $icons = id(new PHUIIconView())->getIcons(); 30 + 31 + $results = array(); 32 + foreach ($icons as $icon) { 33 + $display_name = str_replace('fa-', '', $icon); 34 + $result = id(new PhabricatorTypeaheadResult()) 35 + ->setPHID($icon) 36 + ->setName($icon) 37 + ->setIcon($icon) 38 + ->setDisplayname($display_name) 39 + ->addAttribute($icon); 40 + 41 + $results[$icon] = $result; 42 + } 43 + return $results; 44 + } 45 + 46 + }