Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/differential/customfield/DifferentialRepositoryField.php
12256 views
1
<?php
2
3
final class DifferentialRepositoryField
4
extends DifferentialCoreCustomField {
5
6
public function getFieldKey() {
7
return 'differential:repository';
8
}
9
10
public function getFieldName() {
11
return pht('Repository');
12
}
13
14
public function getFieldDescription() {
15
return pht('Associates a revision with a repository.');
16
}
17
18
protected function readValueFromRevision(
19
DifferentialRevision $revision) {
20
return $revision->getRepositoryPHID();
21
}
22
23
public function shouldAppearInPropertyView() {
24
return true;
25
}
26
27
public function renderPropertyViewValue(array $handles) {
28
return null;
29
}
30
31
public function shouldAppearInDiffPropertyView() {
32
return true;
33
}
34
35
public function renderDiffPropertyViewLabel(DifferentialDiff $diff) {
36
return $this->getFieldName();
37
}
38
39
public function renderDiffPropertyViewValue(DifferentialDiff $diff) {
40
if (!$diff->getRepositoryPHID()) {
41
return null;
42
}
43
44
return $this->getViewer()->renderHandle($diff->getRepositoryPHID());
45
}
46
47
public function shouldAppearInTransactionMail() {
48
return true;
49
}
50
51
public function updateTransactionMailBody(
52
PhabricatorMetaMTAMailBody $body,
53
PhabricatorApplicationTransactionEditor $editor,
54
array $xactions) {
55
56
$repository = $this->getObject()->getRepository();
57
if ($repository === null) {
58
return;
59
}
60
61
$body->addTextSection(
62
pht('REPOSITORY'),
63
$repository->getMonogram().' '.$repository->getName());
64
}
65
66
}
67
68