@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
at recaptime-dev/main 99 lines 1.9 kB view raw
1<?php 2 3final class FuelHandleListItemView 4 extends FuelView { 5 6 private $handle; 7 8 public function setHandle(PhabricatorObjectHandle $handle) { 9 $this->handle = $handle; 10 return $this; 11 } 12 13 public function render() { 14 $cells = array(); 15 16 $cells[] = phutil_tag( 17 'div', 18 array( 19 'class' => 'fuel-handle-list-item-cell fuel-handle-list-item-icon', 20 ), 21 $this->newIconView()); 22 23 $cells[] = phutil_tag( 24 'div', 25 array( 26 'class' => 'fuel-handle-list-item-cell fuel-handle-list-item-handle', 27 ), 28 $this->newHandleView()); 29 30 $cells[] = phutil_tag( 31 'div', 32 array( 33 'class' => 'fuel-handle-list-item-cell fuel-handle-list-item-note', 34 ), 35 $this->newNoteView()); 36 37 return phutil_tag( 38 'div', 39 array( 40 'class' => 'fuel-handle-list-item', 41 ), 42 $cells); 43 } 44 45 46 private function newIconView() { 47 $icon_icon = null; 48 $icon_image = null; 49 $icon_color = null; 50 51 $handle = $this->handle; 52 if ($handle) { 53 $icon_image = $handle->getImageURI(); 54 if (!$icon_image) { 55 $icon_icon = $handle->getIcon(); 56 $icon_color = $handle->getIconColor(); 57 } 58 } 59 60 if ($icon_image === null && $icon_icon === null) { 61 return null; 62 } 63 64 $view = new PHUIIconView(); 65 66 if ($icon_image !== null) { 67 $view->setImage($icon_image); 68 } else { 69 if ($icon_color === null) { 70 $icon_color = 'bluegrey'; 71 } 72 73 if ($icon_icon !== null) { 74 $view->setIcon($icon_icon); 75 } 76 77 if ($icon_color !== null) { 78 $view->setColor($icon_color); 79 } 80 } 81 82 83 return $view; 84 } 85 86 private function newHandleView() { 87 $handle = $this->handle; 88 if ($handle) { 89 return $handle->renderLink(); 90 } 91 92 return null; 93 } 94 95 private function newNoteView() { 96 return null; 97 } 98 99}