Differential D25546 Diff 1830 src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php
Show First 20 Lines • Show All 290 Lines • ▼ Show 20 Lines | $comment_box = id(new PHUIObjectBoxView()) | ||||
->appendChild($comment); | ->appendChild($comment); | ||||
return array($comment_box, $preview); | return array($comment_box, $preview); | ||||
} | } | ||||
private function renderCommentPanel() { | private function renderCommentPanel() { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
// Set a placeholder text in the comment field defined via | |||||
// getCommentFieldPlaceholderText() in the object's EditEngine class | |||||
$placeholder_text = ''; | |||||
$object_phid = $this->getObjectPHID(); | |||||
$phid_types = mpull(PhabricatorPHIDType::getAllInstalledTypes($viewer), | |||||
valerio.bozzolan: Have you already tried this? | |||||
null, 'getTypeConstant'); | |||||
$object_type = idx($phid_types, substr($object_phid, 5, 4)); | |||||
// Find matching EditEngine for our object via ApplicationClasses | |||||
if ($object_type) { | |||||
$app_class = $object_type->getPHIDTypeApplicationClass(); | |||||
$engines = id(new PhabricatorEditEngineQuery()) | |||||
->setViewer($this->getViewer()) | |||||
->execute(); | |||||
$engines = mpull($engines, null, 'getEngineApplicationClass'); | |||||
$engine = idx($engines, $app_class); | |||||
$engine_class = get_class($engine); | |||||
if (method_exists($engine_class, 'getCommentFieldPlaceholderText')) { | |||||
$placeholder_text = | |||||
$engine->getCommentFieldPlaceholderText($object_phid); | |||||
} | |||||
} | |||||
$remarkup_control = id(new PhabricatorRemarkupControl()) | $remarkup_control = id(new PhabricatorRemarkupControl()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->setID($this->getCommentID()) | ->setID($this->getCommentID()) | ||||
->addClass('phui-comment-fullwidth-control') | ->addClass('phui-comment-fullwidth-control') | ||||
->addClass('phui-comment-textarea-control') | ->addClass('phui-comment-textarea-control') | ||||
->setCanPin(true) | ->setCanPin(true) | ||||
->setPlaceholder($placeholder_text) | |||||
->setName('comment'); | ->setName('comment'); | ||||
$draft_comment = ''; | $draft_comment = ''; | ||||
$draft_metadata = array(); | $draft_metadata = array(); | ||||
$draft_key = null; | $draft_key = null; | ||||
$legacy_draft = $this->getDraft(); | $legacy_draft = $this->getDraft(); | ||||
if ($legacy_draft) { | if ($legacy_draft) { | ||||
▲ Show 20 Lines • Show All 327 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
Have you already tried this?