@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 63 lines 1.7 kB view raw
1<?php 2 3final class PholioMockEmbedView extends AphrontView { 4 5 private $mock; 6 private $images = array(); 7 8 public function setMock(PholioMock $mock) { 9 $this->mock = $mock; 10 return $this; 11 } 12 13 public function setImages(array $images) { 14 $this->images = $images; 15 return $this; 16 } 17 18 public function render() { 19 if (!$this->mock) { 20 throw new PhutilInvalidStateException('setMock'); 21 } 22 $mock = $this->mock; 23 24 $images_to_show = array(); 25 $thumbnail = null; 26 if (!empty($this->images)) { 27 $images_to_show = array_intersect_key( 28 $this->mock->getActiveImages(), array_flip($this->images)); 29 } 30 31 $xform = PhabricatorFileTransform::getTransformByKey( 32 PhabricatorFileThumbnailTransform::TRANSFORM_PINBOARD); 33 34 if ($images_to_show) { 35 $image = head($images_to_show); 36 $thumbfile = $image->getFile(); 37 $header = 'M'.$mock->getID().' '.$mock->getName(). 38 ' (#'.$image->getID().')'; 39 $uri = '/M'.$this->mock->getID().'/'.$image->getID().'/'; 40 } else { 41 $thumbfile = $mock->getCoverFile(); 42 $header = 'M'.$mock->getID().' '.$mock->getName(); 43 $uri = '/M'.$this->mock->getID(); 44 } 45 46 $thumbnail = $thumbfile->getURIForTransform($xform); 47 list($x, $y) = $xform->getTransformedDimensions($thumbfile); 48 49 $item = id(new PHUIPinboardItemView()) 50 ->setUser($this->getUser()) 51 ->setObject($mock) 52 ->setHeader($header) 53 ->setURI($uri) 54 ->setImageURI($thumbnail) 55 ->setImageSize($x, $y) 56 ->setDisabled($mock->isClosed()) 57 ->addIconCount('fa-picture-o', count($mock->getActiveImages())) 58 ->addIconCount('fa-trophy', $mock->getTokenCount()); 59 60 return $item; 61 } 62 63}