Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php
12242 views
1
<?php
2
3
final class PhabricatorStandardCustomFieldRemarkup
4
extends PhabricatorStandardCustomField {
5
6
public function getFieldType() {
7
return 'remarkup';
8
}
9
10
public function renderEditControl(array $handles) {
11
return id(new PhabricatorRemarkupControl())
12
->setUser($this->getViewer())
13
->setLabel($this->getFieldName())
14
->setName($this->getFieldKey())
15
->setCaption($this->getCaption())
16
->setValue($this->getFieldValue());
17
}
18
19
public function getStyleForPropertyView() {
20
return 'block';
21
}
22
23
public function getApplicationTransactionRemarkupBlocks(
24
PhabricatorApplicationTransaction $xaction) {
25
return array(
26
$xaction->getNewValue(),
27
);
28
}
29
30
public function renderPropertyViewValue(array $handles) {
31
$value = $this->getFieldValue();
32
33
if ($value === null || !strlen($value)) {
34
return null;
35
}
36
37
// TODO: Once this stabilizes, it would be nice to let fields batch this.
38
// For now, an extra query here and there on object detail pages isn't the
39
// end of the world.
40
41
$viewer = $this->getViewer();
42
return new PHUIRemarkupView($viewer, $value);
43
}
44
45
public function getApplicationTransactionTitle(
46
PhabricatorApplicationTransaction $xaction) {
47
$author_phid = $xaction->getAuthorPHID();
48
return pht(
49
'%s edited %s.',
50
$xaction->renderHandleLink($author_phid),
51
$this->getFieldName());
52
}
53
54
public function getApplicationTransactionTitleForFeed(
55
PhabricatorApplicationTransaction $xaction) {
56
$author_phid = $xaction->getAuthorPHID();
57
$object_phid = $xaction->getObjectPHID();
58
return pht(
59
'%s edited %s on %s.',
60
$xaction->renderHandleLink($author_phid),
61
$this->getFieldName(),
62
$xaction->renderHandleLink($object_phid));
63
}
64
65
public function getApplicationTransactionHasChangeDetails(
66
PhabricatorApplicationTransaction $xaction) {
67
return true;
68
}
69
70
public function getApplicationTransactionChangeDetails(
71
PhabricatorApplicationTransaction $xaction,
72
PhabricatorUser $viewer) {
73
return $xaction->renderTextCorpusChangeDetails(
74
$viewer,
75
$xaction->getOldValue(),
76
$xaction->getNewValue());
77
}
78
79
public function shouldAppearInHerald() {
80
return true;
81
}
82
83
public function getHeraldFieldConditions() {
84
return array(
85
HeraldAdapter::CONDITION_CONTAINS,
86
HeraldAdapter::CONDITION_NOT_CONTAINS,
87
HeraldAdapter::CONDITION_IS,
88
HeraldAdapter::CONDITION_IS_NOT,
89
HeraldAdapter::CONDITION_REGEXP,
90
HeraldAdapter::CONDITION_NOT_REGEXP,
91
);
92
}
93
94
public function getHeraldFieldStandardType() {
95
return HeraldField::STANDARD_TEXT;
96
}
97
98
protected function getHTTPParameterType() {
99
return new AphrontStringHTTPParameterType();
100
}
101
102
public function shouldAppearInApplicationSearch() {
103
return false;
104
}
105
106
public function getConduitEditParameterType() {
107
return new ConduitStringParameterType();
108
}
109
110
protected function newExportFieldType() {
111
return new PhabricatorStringExportField();
112
}
113
114
}
115
116