2016-01-16 06:37:36 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PHUIIconCircleView extends AphrontTagView {
|
|
|
|
|
|
|
|
private $href = null;
|
|
|
|
private $icon;
|
|
|
|
private $color;
|
|
|
|
private $size;
|
|
|
|
|
|
|
|
const SMALL = 'circle-small';
|
|
|
|
const MEDIUM = 'circle-medium';
|
|
|
|
|
|
|
|
public function setHref($href) {
|
|
|
|
$this->href = $href;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2016-01-28 05:38:01 +01:00
|
|
|
public function setIcon($icon) {
|
2016-01-16 06:37:36 +01:00
|
|
|
$this->icon = $icon;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setColor($color) {
|
|
|
|
$this->color = $color;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setSize($size) {
|
|
|
|
$this->size = $size;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getTagName() {
|
|
|
|
$tag = 'span';
|
|
|
|
if ($this->href) {
|
|
|
|
$tag = 'a';
|
|
|
|
}
|
|
|
|
return $tag;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getTagAttributes() {
|
|
|
|
require_celerity_resource('phui-icon-view-css');
|
|
|
|
|
|
|
|
$classes = array();
|
|
|
|
$classes[] = 'phui-icon-circle';
|
|
|
|
|
|
|
|
if ($this->color) {
|
2016-09-15 06:05:19 +02:00
|
|
|
$classes[] = 'hover-'.$this->color;
|
|
|
|
} else {
|
|
|
|
$classes[] = 'hover-sky';
|
2016-01-16 06:37:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($this->size) {
|
|
|
|
$classes[] = $this->size;
|
|
|
|
}
|
|
|
|
|
|
|
|
return array(
|
|
|
|
'href' => $this->href,
|
|
|
|
'class' => $classes,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getTagContent() {
|
|
|
|
return id(new PHUIIconView())
|
2016-09-15 06:05:19 +02:00
|
|
|
->setIcon($this->icon);
|
2016-01-16 06:37:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|