@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
3/**
4 * Implements the value to use for comparison in a Herald rule condition
5 * (e.g. the value which follows after "Assignee | is any of") and the value
6 * to set for a Herald rule action (e.g. what follows after "Add projects"
7 * or "Remove subscribers").
8 */
9abstract class HeraldFieldValue extends Phobject {
10
11 private $viewer;
12
13 const CONTROL_NONE = 'herald.control.none';
14 const CONTROL_TEXT = 'herald.control.text';
15 const CONTROL_SELECT = 'herald.control.select';
16 const CONTROL_TOKENIZER = 'herald.control.tokenizer';
17 const CONTROL_REMARKUP = 'herald.control.remarkup';
18
19 abstract public function getFieldValueKey();
20 abstract public function getControlType();
21 abstract public function renderFieldValue($value);
22 abstract public function renderEditorValue($value);
23
24 public function setViewer(PhabricatorUser $viewer) {
25 $this->viewer = $viewer;
26 return $this;
27 }
28
29 public function getViewer() {
30 return $this->viewer;
31 }
32
33 final public function getControlSpecificationDictionary() {
34 return array(
35 'key' => $this->getFieldValueKey(),
36 'control' => $this->getControlType(),
37 'template' => $this->getControlTemplate(),
38 );
39 }
40
41 protected function getControlTemplate() {
42 return array();
43 }
44
45 public function renderTranscriptValue($value) {
46 return $this->renderFieldValue($value);
47 }
48
49}