Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / releeph / field / specification / ReleephReasonFieldSpecification.php
blob023ea081a14aaf25eb2b213b4e8cf7d7bf1cc9a9
1 <?php
3 final class ReleephReasonFieldSpecification
4 extends ReleephFieldSpecification {
6 public function getFieldKey() {
7 return 'reason';
10 public function getName() {
11 return pht('Reason');
14 public function getStorageKey() {
15 return 'reason';
18 public function getStyleForPropertyView() {
19 return 'block';
22 public function getIconForPropertyView() {
23 return PHUIPropertyListView::ICON_SUMMARY;
26 public function renderPropertyViewValue(array $handles) {
27 return phutil_tag(
28 'div',
29 array(
30 'class' => 'phabricator-remarkup',
32 $this->getMarkupEngineOutput());
35 private $error = true;
37 public function renderEditControl(array $handles) {
38 return id(new AphrontFormTextAreaControl())
39 ->setLabel(pht('Reason'))
40 ->setName('reason')
41 ->setError($this->error)
42 ->setValue($this->getValue());
45 public function validate($reason) {
46 if (!$reason) {
47 $this->error = pht('Required');
48 throw new ReleephFieldParseException(
49 $this,
50 pht('You must give a reason for your request.'));
54 public function renderHelpForArcanist() {
55 $text = pht(
56 'Fully explain why you are requesting this code be included '.
57 'in the next release.')."\n";
58 return phutil_console_wrap($text, 8);
61 public function shouldAppearOnCommitMessage() {
62 return true;
65 public function renderLabelForCommitMessage() {
66 return pht('Request Reason');
69 public function renderValueForCommitMessage() {
70 return $this->getValue();
73 public function shouldMarkup() {
74 return true;
77 public function getMarkupText($field) {
78 $reason = $this->getValue();
79 if ($reason) {
80 return $reason;
81 } else {
82 return '';