Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92680894
PeopleHovercardEngineExtension.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, 17:27
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Nov 24, 17:27 (2 d)
Engine
blob
Format
Raw Data
Handle
22485492
Attached To
rPH Phabricator
PeopleHovercardEngineExtension.php
View Options
<?php
final
class
PeopleHovercardEngineExtension
extends
PhabricatorHovercardEngineExtension
{
const
EXTENSIONKEY
=
'people'
;
public
function
isExtensionEnabled
()
{
return
true
;
}
public
function
getExtensionName
()
{
return
pht
(
'User Accounts'
);
}
public
function
canRenderObjectHovercard
(
$object
)
{
return
(
$object
instanceof
PhabricatorUser
);
}
public
function
willRenderHovercards
(
array
$objects
)
{
$viewer
=
$this
->
getViewer
();
$phids
=
mpull
(
$objects
,
'getPHID'
);
$users
=
id
(
new
PhabricatorPeopleQuery
())
->
setViewer
(
$viewer
)
->
withPHIDs
(
$phids
)
->
needAvailability
(
true
)
->
needProfileImage
(
true
)
->
needProfile
(
true
)
->
needBadges
(
true
)
->
execute
();
$users
=
mpull
(
$users
,
null
,
'getPHID'
);
return
array
(
'users'
=>
$users
,
);
}
public
function
renderHovercard
(
PHUIHovercardView
$hovercard
,
PhabricatorObjectHandle
$handle
,
$object
,
$data
)
{
$viewer
=
$this
->
getViewer
();
$user
=
idx
(
$data
[
'users'
],
$object
->
getPHID
());
if
(!
$user
)
{
return
;
}
$user_card
=
id
(
new
PhabricatorUserCardView
())
->
setProfile
(
$user
)
->
setViewer
(
$viewer
);
$hovercard
->
appendChild
(
$user_card
);
}
}
Event Timeline
Log In to Comment