@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at recaptime-dev/main 74 lines 1.9 kB view raw
1<?php 2 3final class ManiphestHovercardEngineExtension 4 extends PhabricatorHovercardEngineExtension { 5 6 const EXTENSIONKEY = 'maniphest'; 7 8 public function isExtensionEnabled() { 9 return PhabricatorApplication::isClassInstalled( 10 PhabricatorManiphestApplication::class); 11 } 12 13 public function getExtensionName() { 14 return pht('Maniphest Tasks'); 15 } 16 17 public function canRenderObjectHovercard($object) { 18 return ($object instanceof ManiphestTask); 19 } 20 21 public function renderHovercard( 22 PHUIHovercardView $hovercard, 23 PhabricatorObjectHandle $handle, 24 $task, 25 $data) { 26 $viewer = $this->getViewer(); 27 require_celerity_resource('phui-workcard-view-css'); 28 29 $id = $task->getID(); 30 $task = id(new ManiphestTaskQuery()) 31 ->setViewer($viewer) 32 ->withIDs(array($id)) 33 ->needProjectPHIDs(true) 34 ->executeOne(); 35 36 $phids = array(); 37 $owner_phid = $task->getOwnerPHID(); 38 if ($owner_phid) { 39 $phids[$owner_phid] = $owner_phid; 40 } 41 foreach ($task->getProjectPHIDs() as $phid) { 42 $phids[$phid] = $phid; 43 } 44 45 $handles = $viewer->loadHandles($phids); 46 $handles = iterator_to_array($handles); 47 48 $card = id(new ProjectBoardTaskCard()) 49 ->setViewer($viewer) 50 ->setTask($task); 51 52 $owner_phid = $task->getOwnerPHID(); 53 if ($owner_phid) { 54 $owner_handle = $handles[$owner_phid]; 55 $card->setOwner($owner_handle); 56 } 57 58 $project_phids = $task->getProjectPHIDs(); 59 $project_handles = array_select_keys($handles, $project_phids); 60 if ($project_handles) { 61 $card->setProjectHandles($project_handles); 62 } 63 64 $item = $card->getItem(); 65 $card = id(new PHUIObjectItemListView()) 66 ->setFlush(true) 67 ->setItemClass('phui-workcard') 68 ->addClass('hovercard-task-view') 69 ->addItem($item); 70 $hovercard->appendChild($card); 71 72 } 73 74}