Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F116070639
PHUIRemarkupView.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Jun 4, 18:25
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Jun 6, 18:25 (5 h, 25 m)
Engine
blob
Format
Raw Data
Handle
26597563
Attached To
rPH Phabricator
PHUIRemarkupView.php
View Options
<?php
/**
* Simple API for rendering blocks of Remarkup.
*
* Example usage:
*
* $fancy_text = new PHUIRemarkupView($viewer, $raw_remarkup);
* $view->appendChild($fancy_text);
*
*/
final
class
PHUIRemarkupView
extends
AphrontView
{
private
$corpus
;
private
$markupType
;
const
DOCUMENT
=
'document'
;
public
function
__construct
(
PhabricatorUser
$viewer
,
$corpus
)
{
$this
->
setUser
(
$viewer
);
$this
->
corpus
=
$corpus
;
}
private
function
setMarkupType
(
$type
)
{
$this
->
markupType
(
$type
);
return
$this
;
}
public
function
render
()
{
$viewer
=
$this
->
getUser
();
$corpus
=
$this
->
corpus
;
$content
=
PhabricatorMarkupEngine
::
renderOneObject
(
id
(
new
PhabricatorMarkupOneOff
())
->
setPreserveLinebreaks
(
true
)
->
setContent
(
$corpus
),
'default'
,
$viewer
);
if
(
$this
->
markupType
==
self
::
DOCUMENT
)
{
return
phutil_tag
(
'div'
,
array
(
'class'
=>
'phabricator-remarkup phui-document-view'
,
),
$content
);
}
return
$content
;
}
}
Event Timeline
Log In to Comment