Add a basic "harbormaster.step.edit" API method
[phabricator/blender.git] / src / view / fuel / FuelMenuItemView.php
blob70799b66307a869d3a2cb87146224f4e2ef5e58f
1 <?php
3 final class FuelMenuItemView
4 extends FuelView {
6 private $name;
7 private $uri;
8 private $icon;
9 private $disabled;
10 private $backgroundColor;
12 public function setURI($uri) {
13 $this->uri = $uri;
14 return $this;
17 public function getURI() {
18 return $this->uri;
21 public function setName($name) {
22 $this->name = $name;
23 return $this;
26 public function getName() {
27 return $this->name;
30 public function setIcon(PHUIIconView $icon) {
31 $this->icon = $icon;
32 return $this;
35 public function getIcon() {
36 return $this->icon;
39 public function newIcon() {
40 $icon = new PHUIIconView();
41 $this->setIcon($icon);
42 return $icon;
45 public function setDisabled($disabled) {
46 $this->disabled = $disabled;
47 return $this;
50 public function getDisabled() {
51 return $this->disabled;
54 public function setBackgroundColor($background_color) {
55 $this->backgroundColor = $background_color;
56 return $this;
59 public function getBackgroundColor() {
60 return $this->backgroundColor;
63 public function render() {
64 $icon = $this->getIcon();
66 $name = $this->getName();
67 $uri = $this->getURI();
69 $icon = phutil_tag(
70 'span',
71 array(
72 'class' => 'fuel-menu-item-icon',
74 $icon);
76 $item_link = phutil_tag(
77 'a',
78 array(
79 'href' => $uri,
80 'class' => 'fuel-menu-item-link',
82 array(
83 $icon,
84 $name,
85 ));
87 $classes = array();
88 $classes[] = 'fuel-menu-item';
90 if ($this->getDisabled()) {
91 $classes[] = 'disabled';
94 $background_color = $this->getBackgroundColor();
95 if ($background_color !== null) {
96 $classes[] = 'fuel-menu-item-background-color-'.$background_color;
100 if ($uri !== null) {
101 $classes[] = 'has-link';
104 $classes = implode(' ', $classes);
106 return phutil_tag(
107 'div',
108 array(
109 'class' => $classes,
111 $item_link);