Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98076234
DifferentialCommitMessageCustomField.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
Thu, Jan 9, 13:13
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Jan 11, 13:13 (2 d)
Engine
blob
Format
Raw Data
Handle
23499845
Attached To
rPH Phabricator
DifferentialCommitMessageCustomField.php
View Options
<?php
abstract
class
DifferentialCommitMessageCustomField
extends
DifferentialCommitMessageField
{
abstract
public
function
getCustomFieldKey
();
public
function
getFieldOrder
()
{
$custom_key
=
$this
->
getCustomFieldKey
();
return
100000
+
$this
->
getCustomFieldOrder
(
$custom_key
);
}
public
function
isFieldEnabled
()
{
$custom_key
=
$this
->
getCustomFieldKey
();
return
$this
->
isCustomFieldEnabled
(
$custom_key
);
}
public
function
readFieldValueFromObject
(
DifferentialRevision
$revision
)
{
$custom_key
=
$this
->
getCustomFieldKey
();
$value
=
$this
->
readCustomFieldValue
(
$revision
,
$custom_key
);
return
$value
;
}
protected
function
readFieldValueFromCustomFieldStorage
(
$value
)
{
return
$value
;
}
protected
function
readJSONFieldValueFromCustomFieldStorage
(
$value
,
$default
)
{
try
{
return
phutil_json_decode
(
$value
);
}
catch
(
PhutilJSONParserException
$ex
)
{
return
$default
;
}
}
protected
function
readCustomFieldValue
(
DifferentialRevision
$revision
,
$key
)
{
$value
=
idx
(
$this
->
getCustomFieldStorage
(),
$key
);
return
$this
->
readFieldValueFromCustomFieldStorage
(
$value
);
}
protected
function
getCustomFieldOrder
(
$key
)
{
$field_list
=
PhabricatorCustomField
::
getObjectFields
(
new
DifferentialRevision
(),
DifferentialCustomField
::
ROLE_COMMITMESSAGE
);
$fields
=
$field_list
->
getFields
();
$idx
=
0
;
foreach
(
$fields
as
$field_key
=>
$value
)
{
if
(
$key
===
$field_key
)
{
return
$idx
;
}
$idx
++;
}
return
$idx
;
}
}
Event Timeline
Log In to Comment