Page MenuHomePhabricator

D17339.diff
No OneTemporary

D17339.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -3371,6 +3371,7 @@
'PhabricatorPhurlURLAccessController' => 'applications/phurl/controller/PhabricatorPhurlURLAccessController.php',
'PhabricatorPhurlURLCommentController' => 'applications/phurl/controller/PhabricatorPhurlURLCommentController.php',
'PhabricatorPhurlURLCreateCapability' => 'applications/phurl/capability/PhabricatorPhurlURLCreateCapability.php',
+ 'PhabricatorPhurlURLDatasource' => 'applications/phurl/typeahead/PhabricatorPhurlURLDatasource.php',
'PhabricatorPhurlURLEditConduitAPIMethod' => 'applications/phurl/conduit/PhabricatorPhurlURLEditConduitAPIMethod.php',
'PhabricatorPhurlURLEditController' => 'applications/phurl/controller/PhabricatorPhurlURLEditController.php',
'PhabricatorPhurlURLEditEngine' => 'applications/phurl/editor/PhabricatorPhurlURLEditEngine.php',
@@ -8521,6 +8522,7 @@
'PhabricatorPhurlURLAccessController' => 'PhabricatorPhurlController',
'PhabricatorPhurlURLCommentController' => 'PhabricatorPhurlController',
'PhabricatorPhurlURLCreateCapability' => 'PhabricatorPolicyCapability',
+ 'PhabricatorPhurlURLDatasource' => 'PhabricatorTypeaheadDatasource',
'PhabricatorPhurlURLEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
'PhabricatorPhurlURLEditController' => 'PhabricatorPhurlController',
'PhabricatorPhurlURLEditEngine' => 'PhabricatorEditEngine',
diff --git a/src/applications/phurl/typeahead/PhabricatorPhurlURLDatasource.php b/src/applications/phurl/typeahead/PhabricatorPhurlURLDatasource.php
new file mode 100644
--- /dev/null
+++ b/src/applications/phurl/typeahead/PhabricatorPhurlURLDatasource.php
@@ -0,0 +1,35 @@
+<?php
+
+final class PhabricatorPhurlURLDatasource
+ extends PhabricatorTypeaheadDatasource {
+
+ public function getBrowseTitle() {
+ return pht('Browse Phurl URLs');
+ }
+
+ public function getPlaceholderText() {
+ return pht('Select a phurl...');
+ }
+
+ public function getDatasourceApplicationClass() {
+ return 'PhabricatorPhurlApplication';
+ }
+
+ public function loadResults() {
+ $query = id(new PhabricatorPhurlURLQuery());
+ $urls = $this->executeQuery($query);
+ $results = array();
+ foreach ($urls as $url) {
+ $result = id(new PhabricatorTypeaheadResult())
+ ->setDisplayName($url->getName())
+ ->setName($url->getName()." ".$url->getAlias())
+ ->setPHID($url->getPHID())
+ ->addAttribute($url->getLongURL());
+
+ $results[] = $result;
+ }
+
+ return $this->filterResultsAgainstTokens($results);
+ }
+
+}

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 5, 8:26 AM (6 h, 28 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6828524
Default Alt Text
D17339.diff (2 KB)

Event Timeline