[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/differential/customfield/ -> DifferentialRevertPlanField.php (source)

   1  <?php
   2  
   3  final class DifferentialRevertPlanField
   4    extends DifferentialStoredCustomField {
   5  
   6    public function getFieldKey() {
   7      return 'phabricator:revert-plan';
   8    }
   9  
  10    public function getFieldKeyForConduit() {
  11      return 'revertPlan';
  12    }
  13  
  14    public function getFieldName() {
  15      return pht('Revert Plan');
  16    }
  17  
  18    public function getFieldDescription() {
  19      return pht('Instructions for reverting/undoing this change.');
  20    }
  21  
  22    public function shouldDisableByDefault() {
  23      return true;
  24    }
  25  
  26    public function shouldAppearInPropertyView() {
  27      return true;
  28    }
  29  
  30    public function renderPropertyViewLabel() {
  31      return $this->getFieldName();
  32    }
  33  
  34    public function getStyleForPropertyView() {
  35      return 'block';
  36    }
  37  
  38    public function getIconForPropertyView() {
  39      return PHUIPropertyListView::ICON_TESTPLAN;
  40    }
  41  
  42    public function renderPropertyViewValue(array $handles) {
  43      if (!strlen($this->getValue())) {
  44        return null;
  45      }
  46  
  47      return PhabricatorMarkupEngine::renderOneObject(
  48        id(new PhabricatorMarkupOneOff())
  49          ->setPreserveLinebreaks(true)
  50          ->setContent($this->getValue()),
  51        'default',
  52        $this->getViewer());
  53    }
  54  
  55    public function shouldAppearInGlobalSearch() {
  56      return true;
  57    }
  58  
  59    public function updateAbstractDocument(
  60      PhabricatorSearchAbstractDocument $document) {
  61      if (strlen($this->getValue())) {
  62        $document->addField('rvrt', $this->getValue());
  63      }
  64    }
  65  
  66    public function shouldAppearInEditView() {
  67      return true;
  68    }
  69  
  70    public function shouldAppearInApplicationTransactions() {
  71      return true;
  72    }
  73  
  74    public function getOldValueForApplicationTransactions() {
  75      return $this->getValue();
  76    }
  77  
  78    public function getNewValueForApplicationTransactions() {
  79      return $this->getValue();
  80    }
  81  
  82    public function readValueFromRequest(AphrontRequest $request) {
  83      $this->setValue($request->getStr($this->getFieldKey()));
  84    }
  85  
  86    public function renderEditControl(array $handles) {
  87      return id(new PhabricatorRemarkupControl())
  88        ->setUser($this->getViewer())
  89        ->setName($this->getFieldKey())
  90        ->setValue($this->getValue())
  91        ->setLabel($this->getFieldName());
  92    }
  93  
  94    public function getApplicationTransactionTitle(
  95      PhabricatorApplicationTransaction $xaction) {
  96      $author_phid = $xaction->getAuthorPHID();
  97      $old = $xaction->getOldValue();
  98      $new = $xaction->getNewValue();
  99  
 100      return pht(
 101        '%s updated the revert plan for this revision.',
 102        $xaction->renderHandleLink($author_phid));
 103    }
 104  
 105    public function getApplicationTransactionTitleForFeed(
 106      PhabricatorApplicationTransaction $xaction,
 107      PhabricatorFeedStory $story) {
 108  
 109      $object_phid = $xaction->getObjectPHID();
 110      $author_phid = $xaction->getAuthorPHID();
 111      $old = $xaction->getOldValue();
 112      $new = $xaction->getNewValue();
 113  
 114      return pht(
 115        '%s updated the revert plan for %s.',
 116        $xaction->renderHandleLink($author_phid),
 117        $xaction->renderHandleLink($object_phid));
 118    }
 119  
 120    public function getApplicationTransactionHasChangeDetails(
 121      PhabricatorApplicationTransaction $xaction) {
 122      return true;
 123    }
 124  
 125    public function getApplicationTransactionChangeDetails(
 126      PhabricatorApplicationTransaction $xaction,
 127      PhabricatorUser $viewer) {
 128      return $xaction->renderTextCorpusChangeDetails(
 129        $viewer,
 130        $xaction->getOldValue(),
 131        $xaction->getNewValue());
 132    }
 133  
 134    public function getApplicationTransactionRemarkupBlocks(
 135      PhabricatorApplicationTransaction $xaction) {
 136      return array($xaction->getNewValue());
 137    }
 138  
 139    public function shouldAppearInCommitMessage() {
 140      return true;
 141    }
 142  
 143    public function renderCommitMessageValue(array $handles) {
 144      return $this->getValue();
 145    }
 146  
 147    public function shouldAppearInConduitDictionary() {
 148      return true;
 149    }
 150  
 151  }


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