Add a basic "harbormaster.step.edit" API method
[phabricator/blender.git] / src / view / fuel / FuelHandleListItemView.php
blob21ea14d745e7f18d565082501d45c59b3f714871
1 <?php
3 final class FuelHandleListItemView
4 extends FuelView {
6 private $handle;
8 public function setHandle(PhabricatorObjectHandle $handle) {
9 $this->handle = $handle;
10 return $this;
13 public function render() {
14 $cells = array();
16 $cells[] = phutil_tag(
17 'div',
18 array(
19 'class' => 'fuel-handle-list-item-cell fuel-handle-list-item-icon',
21 $this->newIconView());
23 $cells[] = phutil_tag(
24 'div',
25 array(
26 'class' => 'fuel-handle-list-item-cell fuel-handle-list-item-handle',
28 $this->newHandleView());
30 $cells[] = phutil_tag(
31 'div',
32 array(
33 'class' => 'fuel-handle-list-item-cell fuel-handle-list-item-note',
35 $this->newNoteView());
37 return phutil_tag(
38 'div',
39 array(
40 'class' => 'fuel-handle-list-item',
42 $cells);
46 private function newIconView() {
47 $icon_icon = null;
48 $icon_image = null;
49 $icon_color = null;
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();
60 if ($icon_image === null && $icon_icon === null) {
61 return null;
64 $view = new PHUIIconView();
66 if ($icon_image !== null) {
67 $view->setImage($icon_image);
68 } else {
69 if ($icon_color === null) {
70 $icon_color = 'bluegrey';
73 if ($icon_icon !== null) {
74 $view->setIcon($icon_icon);
77 if ($icon_color !== null) {
78 $view->setColor($icon_color);
83 return $view;
86 private function newHandleView() {
87 $handle = $this->handle;
88 if ($handle) {
89 return $handle->renderLink();
92 return null;
95 private function newNoteView() {
96 return null;