1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-24 15:52:41 +01:00
phorge-phorge/src/view/phui/PHUIBadgeMiniView.php
Chad Little 36158dbdc0 Convert all calls to 'IconFont' to just 'Icon'
Summary: Mostly for consistency, we're not using other forms of icons and this makes all classes that use an icon call it in the same way.

Test Plan: tested uiexamples, lots of other random pages.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D15125
2016-01-27 20:59:27 -08:00

71 lines
1.4 KiB
PHP

<?php
final class PHUIBadgeMiniView extends AphrontTagView {
private $href;
private $icon;
private $quality;
private $header;
private $tipDirection;
public function setIcon($icon) {
$this->icon = $icon;
return $this;
}
public function setHref($href) {
$this->href = $href;
return $this;
}
public function setQuality($quality) {
$this->quality = $quality;
return $this;
}
public function setHeader($header) {
$this->header = $header;
return $this;
}
public function setTipDirection($direction) {
$this->tipDirection = $direction;
return $this;
}
protected function getTagName() {
if ($this->href) {
return 'a';
} else {
return 'span';
}
}
protected function getTagAttributes() {
require_celerity_resource('phui-badge-view-css');
Javelin::initBehavior('phabricator-tooltips');
$classes = array();
$classes[] = 'phui-badge-mini';
if ($this->quality) {
$classes[] = 'phui-badge-mini-'.$this->quality;
}
return array(
'class' => implode(' ', $classes),
'sigil' => 'has-tooltip',
'href' => $this->href,
'meta' => array(
'tip' => $this->header,
'align' => $this->tipDirection,
'size' => 300,
),
);
}
protected function getTagContent() {
return id(new PHUIIconView())
->setIcon($this->icon);
}
}