1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-28 14:39:36 +01:00
phorge-phorge/src/applications/herald/value/HeraldFieldValue.php
epriestley a0a346be34 In Herald transcripts, render some field values in a more readable way
Summary:
Ref T13480. Currently, some Herald field types are rendered in an unfriendly way on transcripts. Particularly, PHID lists are rendered as raw PHIDs.

Improve this by delegating rendering to Value objects and letting "PHID List" value objects render more sensible handle lists. Also improve "bool" fields a bit and make more fields render an explicit "None" / empty value rather than just rendering nothing.

Test Plan: Viewed various transcripts, including transcripts covering boolean values, the "Always" condition, large blocks of text, and PHID lists.

Maniphest Tasks: T13480

Differential Revision: https://secure.phabricator.com/D20951
2020-01-29 15:14:06 -08:00

43 lines
1.1 KiB
PHP

<?php
abstract class HeraldFieldValue extends Phobject {
private $viewer;
const CONTROL_NONE = 'herald.control.none';
const CONTROL_TEXT = 'herald.control.text';
const CONTROL_SELECT = 'herald.control.select';
const CONTROL_TOKENIZER = 'herald.control.tokenizer';
const CONTROL_REMARKUP = 'herald.control.remarkup';
abstract public function getFieldValueKey();
abstract public function getControlType();
abstract public function renderFieldValue($value);
abstract public function renderEditorValue($value);
public function setViewer(PhabricatorUser $viewer) {
$this->viewer = $viewer;
return $this;
}
public function getViewer() {
return $this->viewer;
}
final public function getControlSpecificationDictionary() {
return array(
'key' => $this->getFieldValueKey(),
'control' => $this->getControlType(),
'template' => $this->getControlTemplate(),
);
}
protected function getControlTemplate() {
return array();
}
public function renderTranscriptValue($value) {
return $this->renderFieldValue($value);
}
}