Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2891840
PhabricatorProjectHovercardEngineExtension.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
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'
)
;
$custom_fields
=
array
(
)
;
foreach
(
$projects
as
$project
)
{
$field
=
PhabricatorCustomField
::
getObjectField
(
$project
,
PhabricatorCustomField
::
ROLE_VIEW
,
'std:project:internal:description'
)
;
if
(
$field
===
null
)
{
// This means the field is disabled, it would always be null.
break
;
}
$field
->
setViewer
(
$viewer
)
->
readValueFromObject
(
$project
)
;
$custom_fields
[
]
=
$field
;
}
id
(
new
PhabricatorCustomFieldStorageQuery
(
)
)
->
addFields
(
$custom_fields
)
->
execute
(
)
;
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
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 15:50 (2 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1126173
Default Alt Text
PhabricatorProjectHovercardEngineExtension.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment