Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/differential/customfield/DifferentialSummaryField.php
12256 views
1
<?php
2
3
final class DifferentialSummaryField
4
extends DifferentialCoreCustomField {
5
6
public function getFieldKey() {
7
return 'differential:summary';
8
}
9
10
public function getFieldName() {
11
return pht('Summary');
12
}
13
14
public function getFieldDescription() {
15
return pht('Stores a summary of the revision.');
16
}
17
18
protected function readValueFromRevision(
19
DifferentialRevision $revision) {
20
if (!$revision->getID()) {
21
return null;
22
}
23
return $revision->getSummary();
24
}
25
26
public function shouldAppearInGlobalSearch() {
27
return true;
28
}
29
30
public function updateAbstractDocument(
31
PhabricatorSearchAbstractDocument $document) {
32
if (strlen($this->getValue())) {
33
$document->addField('body', $this->getValue());
34
}
35
}
36
37
public function shouldAppearInPropertyView() {
38
return true;
39
}
40
41
public function renderPropertyViewLabel() {
42
return $this->getFieldName();
43
}
44
45
public function getStyleForPropertyView() {
46
return 'block';
47
}
48
49
public function getIconForPropertyView() {
50
return PHUIPropertyListView::ICON_SUMMARY;
51
}
52
53
public function renderPropertyViewValue(array $handles) {
54
if (!strlen($this->getValue())) {
55
return null;
56
}
57
58
return new PHUIRemarkupView($this->getViewer(), $this->getValue());
59
}
60
61
public function shouldAppearInTransactionMail() {
62
return true;
63
}
64
65
public function updateTransactionMailBody(
66
PhabricatorMetaMTAMailBody $body,
67
PhabricatorApplicationTransactionEditor $editor,
68
array $xactions) {
69
70
if (!$editor->isFirstBroadcast()) {
71
return;
72
}
73
74
$summary = $this->getValue();
75
if (!strlen(trim($summary))) {
76
return;
77
}
78
79
$body->addRemarkupSection(pht('REVISION SUMMARY'), $summary);
80
}
81
82
}
83
84