[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

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

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


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