Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92678527
PhabricatorProjectHovercardEngineExtension.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
Fri, Nov 22, 16:56
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Nov 24, 16:56 (2 d)
Engine
blob
Format
Raw Data
Handle
22485307
Attached To
rPH Phabricator
PhabricatorProjectHovercardEngineExtension.php
View Options
<?php
final
class
PhabricatorProjectHovercardEngineExtension
extends
PhabricatorHovercardEngineExtension
{
const
EXTENSIONKEY
=
'project.card'
;
public
function
isExtensionEnabled
()
{
return
true
;
}
public
function
getExtensionName
()
{
return
pht
(
'Project Card'
);
}
public
function
canRenderObjectHovercard
(
$object
)
{
return
(
$object
instanceof
PhabricatorProject
);
}
public
function
willRenderHovercards
(
array
$objects
)
{
$viewer
=
$this
->
getViewer
();
$phids
=
mpull
(
$objects
,
'getPHID'
);
$projects
=
id
(
new
PhabricatorProjectQuery
())
->
setViewer
(
$viewer
)
->
withPHIDs
(
$phids
)
->
needImages
(
true
)
->
execute
();
$projects
=
mpull
(
$projects
,
null
,
'getPHID'
);
return
array
(
'projects'
=>
$projects
,
);
}
public
function
renderHovercard
(
PHUIHovercardView
$hovercard
,
PhabricatorObjectHandle
$handle
,
$object
,
$data
)
{
$viewer
=
$this
->
getViewer
();
$project
=
idx
(
$data
[
'projects'
],
$object
->
getPHID
());
if
(!
$project
)
{
return
;
}
$project_card
=
id
(
new
PhabricatorProjectCardView
())
->
setProject
(
$project
)
->
setViewer
(
$viewer
);
$hovercard
->
appendChild
(
$project_card
);
}
}
Event Timeline
Log In to Comment