Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96120551
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
Sun, Dec 22, 20:43
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Dec 24, 20:43 (2 d)
Engine
blob
Format
Raw Data
Handle
23126428
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
)
->
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