Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98647516
PhabricatorTokensCurtainExtension.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
Wed, Jan 15, 06:03
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Jan 17, 06:03 (2 d)
Engine
blob
Format
Raw Data
Handle
23615116
Attached To
rPH Phabricator
PhabricatorTokensCurtainExtension.php
View Options
<?php
final
class
PhabricatorTokensCurtainExtension
extends
PHUICurtainExtension
{
const
EXTENSIONKEY
=
'tokens.tokens'
;
public
function
shouldEnableForObject
(
$object
)
{
return
(
$object
instanceof
PhabricatorTokenReceiverInterface
);
}
public
function
getExtensionApplication
()
{
return
new
PhabricatorTokensApplication
();
}
public
function
buildCurtainPanel
(
$object
)
{
$viewer
=
$this
->
getViewer
();
$tokens_given
=
id
(
new
PhabricatorTokenGivenQuery
())
->
setViewer
(
$viewer
)
->
withObjectPHIDs
(
array
(
$object
->
getPHID
()))
->
execute
();
if
(!
$tokens_given
)
{
return
null
;
}
$author_phids
=
mpull
(
$tokens_given
,
'getAuthorPHID'
);
$handles
=
$viewer
->
loadHandles
(
$author_phids
);
Javelin
::
initBehavior
(
'phabricator-tooltips'
);
$list
=
array
();
foreach
(
$tokens_given
as
$token_given
)
{
$token
=
$token_given
->
getToken
();
$aural
=
javelin_tag
(
'span'
,
array
(
'aural'
=>
true
,
),
pht
(
'"%s" token, awarded by %s.'
,
$token
->
getName
(),
$handles
[
$token_given
->
getAuthorPHID
()]->
getName
()));
$list
[]
=
javelin_tag
(
'span'
,
array
(
'sigil'
=>
'has-tooltip'
,
'class'
=>
'token-icon'
,
'meta'
=>
array
(
'tip'
=>
$handles
[
$token_given
->
getAuthorPHID
()]->
getName
(),
),
),
array
(
$aural
,
$token
->
renderIcon
(),
));
}
return
$this
->
newPanel
()
->
setHeaderText
(
pht
(
'Tokens'
))
->
setOrder
(
30000
)
->
appendChild
(
$list
);
}
}
Event Timeline
Log In to Comment