[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/releeph/field/specification/ -> ReleephSummaryFieldSpecification.php (source)

   1  <?php
   2  
   3  final class ReleephSummaryFieldSpecification
   4    extends ReleephFieldSpecification {
   5  
   6    const MAX_SUMMARY_LENGTH = 60;
   7  
   8    public function shouldAppearInPropertyView() {
   9      return false;
  10    }
  11  
  12    public function getFieldKey() {
  13      return 'summary';
  14    }
  15  
  16    public function getName() {
  17      return 'Summary';
  18    }
  19  
  20    public function getStorageKey() {
  21      return 'summary';
  22    }
  23  
  24    private $error = false;
  25  
  26    public function renderEditControl(array $handles) {
  27      return id(new AphrontFormTextControl())
  28        ->setLabel('Summary')
  29        ->setName('summary')
  30        ->setError($this->error)
  31        ->setValue($this->getValue())
  32        ->setCaption(
  33          'Leave this blank to use the original commit title');
  34    }
  35  
  36    public function renderHelpForArcanist() {
  37      $text =
  38        "A one-line title summarizing this request. ".
  39        "Leave blank to use the original commit title.\n";
  40      return phutil_console_wrap($text, 8);
  41    }
  42  
  43    public function validate($summary) {
  44      if ($summary && strlen($summary) > self::MAX_SUMMARY_LENGTH) {
  45        $this->error = 'Too long!';
  46        throw new ReleephFieldParseException(
  47          $this, sprintf(
  48            'Please keep your summary to under %d characters.',
  49            self::MAX_SUMMARY_LENGTH));
  50      }
  51    }
  52  
  53  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1