Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93663103
DiffusionHovercardEngineExtension.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, Nov 30, 13:24
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Dec 2, 13:24 (2 d)
Engine
blob
Format
Raw Data
Handle
22685668
Attached To
rPH Phabricator
DiffusionHovercardEngineExtension.php
View Options
<?php
final
class
DiffusionHovercardEngineExtension
extends
PhabricatorHovercardEngineExtension
{
const
EXTENSIONKEY
=
'diffusion'
;
public
function
isExtensionEnabled
()
{
return
PhabricatorApplication
::
isClassInstalled
(
'PhabricatorDiffusionApplication'
);
}
public
function
getExtensionName
()
{
return
pht
(
'Diffusion Commits'
);
}
public
function
canRenderObjectHovercard
(
$object
)
{
return
(
$object
instanceof
PhabricatorRepositoryCommit
);
}
public
function
renderHovercard
(
PHUIHovercardView
$hovercard
,
PhabricatorObjectHandle
$handle
,
$commit
,
$data
)
{
$viewer
=
$this
->
getViewer
();
$author_phid
=
$commit
->
getAuthorPHID
();
if
(
$author_phid
)
{
$author
=
$viewer
->
renderHandle
(
$author_phid
);
}
else
{
$commit_data
=
$commit
->
loadCommitData
();
$author
=
phutil_tag
(
'em'
,
array
(),
$commit_data
->
getAuthorName
());
}
$hovercard
->
setTitle
(
$handle
->
getName
());
$hovercard
->
setDetail
(
$commit
->
getSummary
());
$hovercard
->
addField
(
pht
(
'Author'
),
$author
);
$hovercard
->
addField
(
pht
(
'Date'
),
phabricator_date
(
$commit
->
getEpoch
(),
$viewer
));
if
(
$commit
->
getAuditStatus
()
!=
PhabricatorAuditCommitStatusConstants
::
NONE
)
{
$hovercard
->
addField
(
pht
(
'Audit Status'
),
PhabricatorAuditCommitStatusConstants
::
getStatusName
(
$commit
->
getAuditStatus
()));
}
}
}
Event Timeline
Log In to Comment