Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / releeph / field / specification / ReleephSummaryFieldSpecification.php
blob2341b0d2b58b310c01d97c2ecd654afcf50e8179
1 <?php
3 final class ReleephSummaryFieldSpecification
4 extends ReleephFieldSpecification {
6 const MAX_SUMMARY_LENGTH = 60;
8 public function shouldAppearInPropertyView() {
9 return false;
12 public function getFieldKey() {
13 return 'summary';
16 public function getName() {
17 return pht('Summary');
20 public function getStorageKey() {
21 return 'summary';
24 private $error = false;
26 public function renderEditControl(array $handles) {
27 return id(new AphrontFormTextControl())
28 ->setLabel(pht('Summary'))
29 ->setName('summary')
30 ->setError($this->error)
31 ->setValue($this->getValue())
32 ->setCaption(pht('Leave this blank to use the original commit title'));
35 public function renderHelpForArcanist() {
36 $text = pht(
37 'A one-line title summarizing this request. '.
38 'Leave blank to use the original commit title.')."\n";
39 return phutil_console_wrap($text, 8);
42 public function validate($summary) {
43 if ($summary && strlen($summary) > self::MAX_SUMMARY_LENGTH) {
44 $this->error = pht('Too long!');
45 throw new ReleephFieldParseException(
46 $this,
47 pht(
48 'Please keep your summary to under %d characters.',
49 self::MAX_SUMMARY_LENGTH));