@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<?php
2
3final class PhabricatorEditEngineTokenizerCommentAction
4 extends PhabricatorEditEngineCommentAction {
5
6 private $datasource;
7 private $limit;
8
9 public function setDatasource(PhabricatorTypeaheadDatasource $datasource) {
10 $this->datasource = $datasource;
11 return $this;
12 }
13
14 public function getDatasource() {
15 return $this->datasource;
16 }
17
18 public function setLimit($limit) {
19 $this->limit = $limit;
20 return $this;
21 }
22
23 public function getLimit() {
24 return $this->limit;
25 }
26
27 public function getPHUIXControlType() {
28 return 'tokenizer';
29 }
30
31 public function getPHUIXControlSpecification() {
32 $template = new AphrontTokenizerTemplateView();
33
34 $datasource = $this->getDatasource();
35 $limit = $this->getLimit();
36
37 $value = $this->getValue();
38 if (!$value) {
39 $value = array();
40 }
41 $value = $datasource->getWireTokens($value);
42
43 return array(
44 'markup' => $template->render(),
45 'config' => array(
46 'src' => $datasource->getDatasourceURI(),
47 'browseURI' => $datasource->getBrowseURI(),
48 'placeholder' => $datasource->getPlaceholderText(),
49 'limit' => $limit,
50 ),
51 'value' => $value,
52 );
53 }
54
55}