Changeset View
Changeset View
Standalone View
Standalone View
src/view/phui/PHUIIconView.php
Show All 13 Lines | final class PHUIIconView extends AphrontTagView { | ||||
private $headSize = null; | private $headSize = null; | ||||
private $spriteIcon; | private $spriteIcon; | ||||
private $spriteSheet; | private $spriteSheet; | ||||
private $iconFont; | private $iconFont; | ||||
private $iconColor; | private $iconColor; | ||||
private $iconBackground; | private $iconBackground; | ||||
private $tooltip; | private $tooltip; | ||||
private $emblemColor; | |||||
public function setHref($href) { | public function setHref($href) { | ||||
$this->href = $href; | $this->href = $href; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setImage($image) { | public function setImage($image) { | ||||
$this->image = $image; | $this->image = $image; | ||||
Show All 31 Lines | public function setBackground($color) { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setTooltip($text) { | public function setTooltip($text) { | ||||
$this->tooltip = $text; | $this->tooltip = $text; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setEmblemColor($emblem_color) { | |||||
$this->emblemColor = $emblem_color; | |||||
return $this; | |||||
} | |||||
public function getEmblemColor() { | |||||
return $this->emblemColor; | |||||
} | |||||
protected function getTagName() { | protected function getTagName() { | ||||
$tag = 'span'; | $tag = 'span'; | ||||
if ($this->href) { | if ($this->href) { | ||||
$tag = 'a'; | $tag = 'a'; | ||||
} | } | ||||
return $tag; | return $tag; | ||||
} | } | ||||
Show All 24 Lines | if ($this->spriteIcon) { | ||||
} | } | ||||
$style = 'background-image: url('.$this->image.');'; | $style = 'background-image: url('.$this->image.');'; | ||||
} | } | ||||
if ($this->text) { | if ($this->text) { | ||||
$classes[] = 'phui-icon-has-text'; | $classes[] = 'phui-icon-has-text'; | ||||
$this->appendChild($this->text); | $this->appendChild($this->text); | ||||
} | } | ||||
if ($this->emblemColor) { | |||||
$classes[] = 'phui-icon-emblem phui-icon-emblem-'.$this->emblemColor; | |||||
} | |||||
$sigil = null; | $sigil = null; | ||||
$meta = array(); | $meta = array(); | ||||
if ($this->tooltip) { | if ($this->tooltip) { | ||||
Javelin::initBehavior('phabricator-tooltips'); | Javelin::initBehavior('phabricator-tooltips'); | ||||
require_celerity_resource('aphront-tooltip-css'); | require_celerity_resource('aphront-tooltip-css'); | ||||
$sigil = 'has-tooltip'; | $sigil = 'has-tooltip'; | ||||
$meta = array( | $meta = array( | ||||
'tip' => $this->tooltip, | 'tip' => $this->tooltip, | ||||
▲ Show 20 Lines • Show All 772 Lines • Show Last 20 Lines |