Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99133993
PhrictionDocumentDraftTransaction.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
Tue, Jan 21, 00:13
Size
1007 B
Mime Type
text/x-php
Expires
Thu, Jan 23, 00:13 (2 d)
Engine
blob
Format
Raw Data
Handle
23712506
Attached To
rPH Phabricator
PhrictionDocumentDraftTransaction.php
View Options
<?php
final
class
PhrictionDocumentDraftTransaction
extends
PhrictionDocumentEditTransaction
{
const
TRANSACTIONTYPE
=
'draft'
;
public
function
applyInternalEffects
(
$object
,
$value
)
{
parent
::
applyInternalEffects
(
$object
,
$value
);
$this
->
getEditor
()->
setShouldPublishContent
(
$object
,
false
);
}
public
function
shouldHideForFeed
()
{
return
true
;
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
// NOTE: We're only validating that you can't edit a document down to
// nothing in a draft transaction. Alone, this doesn't prevent you from
// creating a document with no content. The content transaction has
// validation for that.
if
(!
$xactions
)
{
return
$errors
;
}
$content
=
$object
->
getContent
()->
getContent
();
if
(
$this
->
isEmptyTextTransaction
(
$content
,
$xactions
))
{
$errors
[]
=
$this
->
newRequiredError
(
pht
(
'Documents must have content.'
));
}
return
$errors
;
}
}
Event Timeline
Log In to Comment