1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
<?php
final class ReleephReasonFieldSpecification
extends ReleephFieldSpecification {
public function getFieldKey() {
return 'reason';
}
public function getName() {
return pht('Reason');
}
public function getStorageKey() {
return 'reason';
}
public function getStyleForPropertyView() {
return 'block';
}
public function getIconForPropertyView() {
return PHUIPropertyListView::ICON_SUMMARY;
}
public function renderPropertyViewValue(array $handles) {
return phutil_tag(
'div',
array(
'class' => 'phabricator-remarkup',
),
$this->getMarkupEngineOutput());
}
private $error = true;
public function renderEditControl(array $handles) {
return id(new AphrontFormTextAreaControl())
->setLabel(pht('Reason'))
->setName('reason')
->setError($this->error)
->setValue($this->getValue());
}
public function validate($reason) {
if (!$reason) {
$this->error = pht('Required');
throw new ReleephFieldParseException(
$this,
pht('You must give a reason for your request.'));
}
}
public function renderHelpForArcanist() {
$text = pht(
'Fully explain why you are requesting this code be included '.
'in the next release.')."\n";
return phutil_console_wrap($text, 8);
}
public function shouldAppearOnCommitMessage() {
return true;
}
public function renderLabelForCommitMessage() {
return pht('Request Reason');
}
public function renderValueForCommitMessage() {
return $this->getValue();
}
public function shouldMarkup() {
return true;
}
public function getMarkupText($field) {
$reason = $this->getValue();
if ($reason) {
return $reason;
} else {
return '';
}
}
}
|