[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class DifferentialAsanaRepresentationField 4 extends DifferentialCustomField { 5 6 public function getFieldKey() { 7 return 'differential:asana-representation'; 8 } 9 10 public function getFieldName() { 11 return pht('In Asana'); 12 } 13 14 public function canDisableField() { 15 return false; 16 } 17 18 public function getFieldDescription() { 19 return pht('Shows revision representation in Asana.'); 20 } 21 22 public function shouldAppearInPropertyView() { 23 return (bool)PhabricatorEnv::getEnvConfig('asana.workspace-id'); 24 } 25 26 public function renderPropertyViewLabel() { 27 return $this->getFieldName(); 28 } 29 30 public function renderPropertyViewValue(array $handles) { 31 $viewer = $this->getViewer(); 32 $src_phid = $this->getObject()->getPHID(); 33 $edge_type = PhabricatorEdgeConfig::TYPE_PHOB_HAS_ASANATASK; 34 35 $query = id(new PhabricatorEdgeQuery()) 36 ->withSourcePHIDs(array($src_phid)) 37 ->withEdgeTypes(array($edge_type)) 38 ->needEdgeData(true); 39 40 $edges = $query->execute(); 41 if (!$edges) { 42 return null; 43 } 44 45 $edge = head($edges[$src_phid][$edge_type]); 46 47 if (!empty($edge['data']['gone'])) { 48 return phutil_tag( 49 'em', 50 array(), 51 pht('Asana Task Deleted')); 52 } 53 54 $ref = id(new DoorkeeperImportEngine()) 55 ->setViewer($viewer) 56 ->withPHIDs(array($edge['dst'])) 57 ->needLocalOnly(true) 58 ->executeOne(); 59 60 if (!$ref) { 61 return null; 62 } 63 64 return id(new DoorkeeperTagView()) 65 ->setExternalObject($ref->getExternalObject()); 66 } 67 68 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |