Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F19081851
DifferentialCommitMessageCustomField.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
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
(),
PhabricatorCustomField
::
ROLE_DEFAULT
);
$fields
=
$field_list
->
getFields
();
$idx
=
0
;
foreach
(
$fields
as
$field_key
=>
$value
)
{
if
(
$key
===
$field_key
)
{
return
$idx
;
}
$idx
++;
}
return
$idx
;
}
public
function
getFieldTransactions
(
$value
)
{
return
array
(
array
(
'type'
=>
$this
->
getCommitMessageFieldKey
(),
'value'
=>
$value
,
),
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Dec 4, 8:37 AM (1 d, 17 h)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8225565
Default Alt Text
DifferentialCommitMessageCustomField.php (1 KB)
Attached To
Mode
rP Phabricator
Attached
Detach File
Event Timeline
Log In to Comment