Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F596292
PhabricatorCommitChangeIDField.php
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
20after4
Jul 7 2015, 5:34 PM
2015-07-07 17:34:56 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
PhabricatorCommitChangeIDField.php
View Options
<?php
final
class
PhabricatorCommitChangeIDField
extends
PhabricatorCommitCustomField
{
private
$value
;
public
function
getValue
()
{
return
$this
->
value
;
}
public
function
setValue
(
$value
)
{
$this
->
value
=
$value
;
return
$this
;
}
public
function
getFieldKey
()
{
return
'gerrit:change-id'
;
}
public
function
getFieldKeyForConduit
()
{
return
'changeID'
;
}
public
function
getFieldName
()
{
return
pht
(
'Change-Id'
);
}
public
function
getFieldDescription
()
{
return
pht
(
'Ties commits to gerrit changes and provides a permanent link between them.'
);
}
public
function
canDisableField
()
{
return
true
;
}
public
function
shouldDisableByDefault
()
{
return
true
;
}
public
function
shouldAppearInTransactionMail
()
{
return
true
;
}
public
function
getValueForStorage
()
{
return
json_encode
(
$this
->
getValue
());
}
public
function
setValueFromStorage
(
$value
)
{
try
{
$this
->
setValue
(
phutil_json_decode
(
$value
));
}
catch
(
PhutilJSONParserException
$ex
)
{
$this
->
setValue
(
array
());
}
return
$this
;
}
public
function
readValueFromRequest
(
AphrontRequest
$request
)
{
$this
->
setValue
(
$request
->
getStrList
(
$this
->
getFieldKey
()));
return
$this
;
}
public
function
shouldAppearInPropertyView
()
{
return
true
;
}
public
function
renderPropertyViewLabel
()
{
return
$this
->
getFieldName
();
}
public
function
renderPropertyViewValue
(
array
$handles
)
{
$links
=
array
();
foreach
(
$this
->
getValue
()
as
$value
)
{
$url
=
'https://gerrit.wikimedia.org/r/#q,'
.
$value
.
',n,z'
;
$links
[]
=
phutil_tag
(
'a'
,
array
(
'href'
=>
$url
,
'title'
=>
pht
(
'View Change in Gerrit'
),
'target'
=>
'_blank'
),
$value
);
}
return
phutil_tag
(
'span'
,
array
(),
$links
);
}
public
function
shouldAppearInCommitMessage
()
{
return
true
;
}
public
function
parseValueFromCommitMessage
(
$value
)
{
return
preg_split
(
'/[
\s
,]+/'
,
$value
,
$limit
=
-
1
,
PREG_SPLIT_NO_EMPTY
);
}
public
function
renderCommitMessageValue
(
array
$handles
)
{
return
$this
->
getValue
();
}
public
function
readValueFromCommitMessage
(
$value
)
{
$this
->
setValue
(
$value
);
return
$this
;
}
public
function
shouldAppearInApplicationTransactions
()
{
return
true
;
}
public
function
getOldValueForApplicationTransactions
()
{
return
$this
->
getValue
();
}
public
function
getNewValueForApplicationTransactions
()
{
return
$this
->
getValue
();
}
}
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/bv/qh/vnbtqoreio2nwk2b
Default Alt Text
PhabricatorCommitChangeIDField.php (2 KB)
Attached To
Mode
P1819 PhabricatorCommitChangeIDField.php
Attached
Detach File
Event Timeline
Log In to Comment