Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F950521
PhrictionContent.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
PhrictionContent.php
View Options
<?php
/**
* @task markup Markup Interface
*/
final
class
PhrictionContent
extends
PhrictionDAO
implements
PhabricatorMarkupInterface
{
const
MARKUP_FIELD_BODY
=
'markup:body'
;
protected
$id
;
protected
$documentID
;
protected
$version
;
protected
$authorPHID
;
protected
$title
;
protected
$slug
;
protected
$content
;
protected
$description
;
protected
$changeType
;
protected
$changeRef
;
public
function
renderContent
(
PhabricatorUser
$viewer
)
{
return
PhabricatorMarkupEngine
::
renderOneObject
(
$this
,
self
::
MARKUP_FIELD_BODY
,
$viewer
);
}
public
function
getConfiguration
()
{
return
array
(
self
::
CONFIG_COLUMN_SCHEMA
=>
array
(
'version'
=>
'uint32'
,
'title'
=>
'sort'
,
'slug'
=>
'text128'
,
'content'
=>
'text'
,
'changeType'
=>
'uint32'
,
'changeRef'
=>
'uint32?'
,
// T6203/NULLABILITY
// This should just be empty if not provided?
'description'
=>
'text?'
,
),
self
::
CONFIG_KEY_SCHEMA
=>
array
(
'documentID'
=>
array
(
'columns'
=>
array
(
'documentID'
,
'version'
),
'unique'
=>
true
,
),
'authorPHID'
=>
array
(
'columns'
=>
array
(
'authorPHID'
),
),
'slug'
=>
array
(
'columns'
=>
array
(
'slug'
),
),
),
)
+
parent
::
getConfiguration
();
}
/* -( Markup Interface )--------------------------------------------------- */
/**
* @task markup
*/
public
function
getMarkupFieldKey
(
$field
)
{
if
(
$this
->
shouldUseMarkupCache
(
$field
))
{
$id
=
$this
->
getID
();
}
else
{
$id
=
PhabricatorHash
::
digest
(
$this
->
getMarkupText
(
$field
));
}
return
"phriction:{$field}:{$id}"
;
}
/**
* @task markup
*/
public
function
getMarkupText
(
$field
)
{
return
$this
->
getContent
();
}
/**
* @task markup
*/
public
function
newMarkupEngine
(
$field
)
{
return
PhabricatorMarkupEngine
::
newPhrictionMarkupEngine
();
}
/**
* @task markup
*/
public
function
didMarkupText
(
$field
,
$output
,
PhutilMarkupEngine
$engine
)
{
$toc
=
PhutilRemarkupHeaderBlockRule
::
renderTableOfContents
(
$engine
);
if
(
$toc
)
{
$toc
=
phutil_tag_div
(
'phabricator-remarkup-toc'
,
array
(
phutil_tag_div
(
'phabricator-remarkup-toc-header'
,
pht
(
'Table of Contents'
)),
$toc
,
));
}
return
phutil_tag_div
(
'phabricator-remarkup'
,
array
(
$toc
,
$output
));
}
/**
* @task markup
*/
public
function
shouldUseMarkupCache
(
$field
)
{
return
(
bool
)
$this
->
getID
();
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Jun 17, 2:08 PM (1 d, 4 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
225014
Default Alt Text
PhrictionContent.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment