Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98254584
DifferentialViewPolicyField.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
Sat, Jan 11, 12:15
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Jan 13, 12:15 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
23537406
Attached To
rPH Phabricator
DifferentialViewPolicyField.php
View Options
<?php
final
class
DifferentialViewPolicyField
extends
DifferentialCoreCustomField
{
public
function
getFieldKey
()
{
return
'differential:view-policy'
;
}
public
function
getFieldName
()
{
return
pht
(
'View Policy'
);
}
public
function
getFieldDescription
()
{
return
pht
(
'Controls visibility.'
);
}
protected
function
readValueFromRevision
(
DifferentialRevision
$revision
)
{
return
$revision
->
getViewPolicy
();
}
protected
function
writeValueToRevision
(
DifferentialRevision
$revision
,
$value
)
{
$revision
->
setViewPolicy
(
$value
);
}
public
function
readValueFromRequest
(
AphrontRequest
$request
)
{
$this
->
setValue
(
$request
->
getStr
(
$this
->
getFieldKey
()));
}
public
function
renderEditControl
(
array
$handles
)
{
$viewer
=
$this
->
getViewer
();
$revision
=
$this
->
getObject
();
$policies
=
id
(
new
PhabricatorPolicyQuery
())
->
setViewer
(
$viewer
)
->
setObject
(
$revision
)
->
execute
();
return
id
(
new
AphrontFormPolicyControl
())
->
setUser
(
$viewer
)
->
setCapability
(
PhabricatorPolicyCapability
::
CAN_VIEW
)
->
setPolicyObject
(
$revision
)
->
setPolicies
(
$policies
)
->
setName
(
$this
->
getFieldKey
())
->
setValue
(
$this
->
getValue
())
->
setError
(
$this
->
getFieldError
());
}
public
function
getApplicationTransactionType
()
{
return
PhabricatorTransactions
::
TYPE_VIEW_POLICY
;
}
}
Event Timeline
Log In to Comment