3 final class PhabricatorTokensCurtainExtension
4 extends PHUICurtainExtension
{
6 const EXTENSIONKEY
= 'tokens.tokens';
8 public function shouldEnableForObject($object) {
9 return ($object instanceof PhabricatorTokenReceiverInterface
);
12 public function getExtensionApplication() {
13 return new PhabricatorTokensApplication();
16 public function buildCurtainPanel($object) {
17 $viewer = $this->getViewer();
19 $tokens_given = id(new PhabricatorTokenGivenQuery())
21 ->withObjectPHIDs(array($object->getPHID()))
27 $author_phids = mpull($tokens_given, 'getAuthorPHID');
28 $handles = $viewer->loadHandles($author_phids);
30 Javelin
::initBehavior('phabricator-tooltips');
33 foreach ($tokens_given as $token_given) {
34 $token = $token_given->getToken();
42 '"%s" token, awarded by %s.',
44 $handles[$token_given->getAuthorPHID()]->getName()));
46 $list[] = javelin_tag(
49 'sigil' => 'has-tooltip',
50 'class' => 'token-icon',
52 'tip' => $handles[$token_given->getAuthorPHID()]->getName(),
61 return $this->newPanel()
62 ->setHeaderText(pht('Tokens'))