Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F459729
DifferentialCommitMessageField.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
DifferentialCommitMessageField.php
View Options
<?php
abstract
class
DifferentialCommitMessageField
extends
Phobject
{
private
$viewer
;
final
public
function
setViewer
(
PhabricatorUser
$viewer
)
{
$this
->
viewer
=
$viewer
;
return
$this
;
}
final
public
function
getViewer
()
{
return
$this
->
viewer
;
}
abstract
public
function
getFieldName
();
public
function
isFieldEnabled
()
{
return
true
;
}
public
function
getFieldAliases
()
{
return
array
();
}
public
function
validateFieldValue
(
$value
)
{
return
;
}
public
function
parseFieldValue
(
$value
)
{
return
$value
;
}
final
public
function
getCommitMessageFieldKey
()
{
return
$this
->
getPhobjectClassConstant
(
'FIELDKEY'
,
64
);
}
final
public
static
function
newEnabledFields
(
PhabricatorUser
$viewer
)
{
$fields
=
self
::
getAllFields
();
$results
=
array
();
foreach
(
$fields
as
$key
=>
$field
)
{
$field
=
clone
$field
;
$field
->
setViewer
(
$viewer
);
if
(
$field
->
isFieldEnabled
())
{
$results
[
$key
]
=
$field
;
}
}
return
$results
;
}
final
public
static
function
getAllFields
()
{
return
id
(
new
PhutilClassMapQuery
())
->
setAncestorClass
(
__CLASS__
)
->
setUniqueMethod
(
'getCommitMessageFieldKey'
)
->
execute
();
}
protected
function
raiseParseException
(
$message
)
{
throw
new
DifferentialFieldParseException
(
$message
);
}
protected
function
raiseValidationException
(
$message
)
{
throw
new
DifferentialFieldValidationException
(
$message
);
}
protected
function
parseObjectList
(
$value
,
array
$types
,
$allow_partial
=
false
,
array
$suffixes
=
array
())
{
return
id
(
new
PhabricatorObjectListQuery
())
->
setViewer
(
$this
->
getViewer
())
->
setAllowedTypes
(
$types
)
->
setObjectList
(
$value
)
->
setAllowPartialResults
(
$allow_partial
)
->
setSuffixes
(
$suffixes
)
->
execute
();
}
protected
function
isCustomFieldEnabled
(
$key
)
{
$field_list
=
PhabricatorCustomField
::
getObjectFields
(
new
DifferentialRevision
(),
PhabricatorCustomField
::
ROLE_VIEW
);
$fields
=
$field_list
->
getFields
();
return
isset
(
$fields
[
$key
]);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 5, 2:31 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
71919
Default Alt Text
DifferentialCommitMessageField.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment