[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

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

   1  <?php
   2  
   3  final class DifferentialManiphestTasksField
   4    extends DifferentialCoreCustomField {
   5  
   6    public function getFieldKey() {
   7      return 'differential:maniphest-tasks';
   8    }
   9  
  10    public function getFieldKeyForConduit() {
  11      return 'maniphestTaskPHIDs';
  12    }
  13  
  14    public function canDisableField() {
  15      return false;
  16    }
  17  
  18    public function shouldAppearInEditView() {
  19      return false;
  20    }
  21  
  22    public function getFieldName() {
  23      return pht('Maniphest Tasks');
  24    }
  25  
  26    public function getFieldDescription() {
  27      return pht('Lists associated tasks.');
  28    }
  29  
  30    public function shouldAppearInPropertyView() {
  31      return true;
  32    }
  33  
  34    public function renderPropertyViewLabel() {
  35      return $this->getFieldName();
  36    }
  37  
  38    public function readValueFromRevision(DifferentialRevision $revision) {
  39      if (!$revision->getPHID()) {
  40        return array();
  41      }
  42  
  43      return PhabricatorEdgeQuery::loadDestinationPHIDs(
  44        $revision->getPHID(),
  45        DifferentialRevisionHasTaskEdgeType::EDGECONST);
  46    }
  47  
  48    public function getApplicationTransactionType() {
  49      return PhabricatorTransactions::TYPE_EDGE;
  50    }
  51  
  52    public function getApplicationTransactionMetadata() {
  53      return array(
  54        'edge:type' => DifferentialRevisionHasTaskEdgeType::EDGECONST,
  55      );
  56    }
  57  
  58    public function getNewValueForApplicationTransactions() {
  59      $edges = array();
  60      foreach ($this->getValue() as $phid) {
  61        $edges[$phid] = $phid;
  62      }
  63  
  64      return array('=' => $edges);
  65    }
  66  
  67    public function getRequiredHandlePHIDsForPropertyView() {
  68      return $this->getValue();
  69    }
  70  
  71    public function renderPropertyViewValue(array $handles) {
  72      return $this->renderHandleList($handles);
  73    }
  74  
  75    public function shouldAppearInCommitMessage() {
  76      return true;
  77    }
  78  
  79    public function shouldAllowEditInCommitMessage() {
  80      return true;
  81    }
  82  
  83    public function getCommitMessageLabels() {
  84      return array(
  85        'Maniphest Task',
  86        'Maniphest Tasks',
  87      );
  88    }
  89  
  90    public function parseValueFromCommitMessage($value) {
  91      return $this->parseObjectList(
  92        $value,
  93        array(
  94          ManiphestTaskPHIDType::TYPECONST,
  95        ));
  96    }
  97  
  98    public function getRequiredHandlePHIDsForCommitMessage() {
  99      return $this->getRequiredHandlePHIDsForPropertyView();
 100    }
 101  
 102    public function renderCommitMessageValue(array $handles) {
 103      return $this->renderObjectList($handles);
 104    }
 105  
 106    public function getProTips() {
 107      return array(
 108        pht(
 109          'Write "Fixes T123" in your summary to automatically close the '.
 110          'corresponding task when this change lands.'),
 111      );
 112    }
 113  
 114  }


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