Skip to content

Commit 0569938

Browse files
aviveyavivey
authored and
avivey
committedJul 6, 2016
expose renderHandle in PhabricatorModularTransactionType
Test Plan: Tested with a transactionType from an extension. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin Maniphest Tasks: T9789 Differential Revision: https://secure.phabricator.com/D16236
1 parent 989b585 commit 0569938

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed
 

‎src/applications/phid/view/PHUIHandleView.php

+10
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ final class PHUIHandleView
1414
private $handleList;
1515
private $handlePHID;
1616
private $asTag;
17+
private $asText;
1718
private $useShortName;
1819
private $showHovercard;
1920

@@ -32,6 +33,11 @@ public function setAsTag($tag) {
3233
return $this;
3334
}
3435

36+
public function setAsText($as_text) {
37+
$this->asText = $as_text;
38+
return $this;
39+
}
40+
3541
public function setUseShortName($short) {
3642
$this->useShortName = $short;
3743
return $this;
@@ -55,6 +61,10 @@ public function render() {
5561
return $tag;
5662
}
5763

64+
if ($this->asText) {
65+
return $handle->getLinkName();
66+
}
67+
5868
if ($this->useShortName) {
5969
$name = $handle->getName();
6070
} else {

‎src/applications/transactions/storage/PhabricatorModularTransaction.php

+5
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ final public function getColor() {
116116
return parent::getColor();
117117
}
118118

119+
public function attachViewer(PhabricatorUser $viewer) {
120+
$this->getTransactionImplementation()->setViewer($viewer);
121+
return parent::attachViewer($viewer);
122+
}
123+
119124
final public function hasChangeDetails() {
120125
if ($this->getTransactionImplementation()->hasChangeDetailView()) {
121126
return true;

‎src/applications/transactions/storage/PhabricatorModularTransactionType.php

+12
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,18 @@ final protected function renderObject() {
129129
return $this->getStorage()->renderHandleLink($object_phid);
130130
}
131131

132+
final protected function renderHandle($phid) {
133+
$viewer = $this->getViewer();
134+
$display = $viewer->renderHandle($phid);
135+
136+
$rendering_target = $this->getStorage()->getRenderingTarget();
137+
if ($rendering_target == PhabricatorApplicationTransaction::TARGET_TEXT) {
138+
$display->setAsText(true);
139+
}
140+
141+
return $display;
142+
}
143+
132144
final protected function newError($title, $message, $xaction = null) {
133145
return new PhabricatorApplicationTransactionValidationError(
134146
$this->getTransactionTypeConstant(),

0 commit comments

Comments
 (0)
Failed to load comments.