diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 0c3995d41d..749876acc9 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1459,6 +1459,7 @@ phutil_register_library_map(array( 'PHUIPropertyListExample' => 'applications/uiexample/examples/PHUIPropertyListExample.php', 'PHUIPropertyListView' => 'view/phui/PHUIPropertyListView.php', 'PHUIRemarkupPreviewPanel' => 'view/phui/PHUIRemarkupPreviewPanel.php', + 'PHUIRemarkupView' => 'infrastructure/markup/view/PHUIRemarkupView.php', 'PHUISpacesNamespaceContextView' => 'applications/spaces/view/PHUISpacesNamespaceContextView.php', 'PHUIStatusItemView' => 'view/phui/PHUIStatusItemView.php', 'PHUIStatusListView' => 'view/phui/PHUIStatusListView.php', @@ -5352,6 +5353,7 @@ phutil_register_library_map(array( 'PHUIPropertyListExample' => 'PhabricatorUIExample', 'PHUIPropertyListView' => 'AphrontView', 'PHUIRemarkupPreviewPanel' => 'AphrontTagView', + 'PHUIRemarkupView' => 'AphrontView', 'PHUISpacesNamespaceContextView' => 'AphrontView', 'PHUIStatusItemView' => 'AphrontTagView', 'PHUIStatusListView' => 'AphrontTagView', diff --git a/src/applications/badges/controller/PhabricatorBadgesViewController.php b/src/applications/badges/controller/PhabricatorBadgesViewController.php index abaafe6d0f..411970f0bd 100644 --- a/src/applications/badges/controller/PhabricatorBadgesViewController.php +++ b/src/applications/badges/controller/PhabricatorBadgesViewController.php @@ -104,14 +104,10 @@ final class PhabricatorBadgesViewController $description = $badge->getDescription(); if (strlen($description)) { - $description = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($description), - 'default', - $viewer); - $view->addSectionHeader( pht('Description'), PHUIPropertyListView::ICON_SUMMARY); - $view->addTextContent($description); + $view->addTextContent( + new PHUIRemarkupView($viewer, $description)); } $badge = id(new PHUIBadgeView()) diff --git a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php index 79312b5480..e570861f29 100644 --- a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php +++ b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php @@ -195,15 +195,10 @@ final class PhabricatorConduitConsoleController pht('Errors'), $error_description); - - $description = $method->getMethodDescription(); - $description = PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff())->setContent($description), - 'default', - $viewer); $view->addSectionHeader( pht('Description'), PHUIPropertyListView::ICON_SUMMARY); - $view->addTextContent($description); + $view->addTextContent( + new PHUIRemarkupView($viewer, $method->getMethodDescription())); return $view; } diff --git a/src/applications/passphrase/controller/PassphraseCredentialViewController.php b/src/applications/passphrase/controller/PassphraseCredentialViewController.php index 46fd0c4c7a..46ae06cdc7 100644 --- a/src/applications/passphrase/controller/PassphraseCredentialViewController.php +++ b/src/applications/passphrase/controller/PassphraseCredentialViewController.php @@ -201,11 +201,7 @@ final class PassphraseCredentialViewController extends PassphraseController { pht('Description'), PHUIPropertyListView::ICON_SUMMARY); $properties->addTextContent( - PhabricatorMarkupEngine::renderOneObject( - id(new PhabricatorMarkupOneOff()) - ->setContent($description), - 'default', - $viewer)); + new PHUIRemarkupView($viewer, $description)); } return $properties; diff --git a/src/infrastructure/markup/PhabricatorMarkupOneOff.php b/src/infrastructure/markup/PhabricatorMarkupOneOff.php index 7f1708745c..0bfba1722f 100644 --- a/src/infrastructure/markup/PhabricatorMarkupOneOff.php +++ b/src/infrastructure/markup/PhabricatorMarkupOneOff.php @@ -1,16 +1,7 @@ setContent($some_content), - * 'default', - * $viewer); - * - * This is less efficient than batching rendering, but appropriate for small - * amounts of one-off text in form instructions. + * DEPRECATED. Use @{class:PHUIRemarkupView}. */ final class PhabricatorMarkupOneOff extends Phobject diff --git a/src/infrastructure/markup/view/PHUIRemarkupView.php b/src/infrastructure/markup/view/PHUIRemarkupView.php new file mode 100644 index 0000000000..0272c9c3a9 --- /dev/null +++ b/src/infrastructure/markup/view/PHUIRemarkupView.php @@ -0,0 +1,32 @@ +appendChild($fancy_text); + * + */ +final class PHUIRemarkupView extends AphrontView { + + private $corpus; + + public function __construct(PhabricatorUser $viewer, $corpus) { + $this->setUser($viewer); + $this->corpus = $corpus; + } + + public function render() { + $viewer = $this->getUser(); + $corpus = $this->corpus; + + return PhabricatorMarkupEngine::renderOneObject( + id(new PhabricatorMarkupOneOff()) + ->setContent($corpus), + 'default', + $viewer); + } + +}