mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-28 09:42:41 +01:00
36158dbdc0
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
67 lines
1.2 KiB
PHP
67 lines
1.2 KiB
PHP
<?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;
|
|
}
|
|
|
|
public function setIcon($icon) {
|
|
$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) {
|
|
$classes[] = 'phui-icon-circle-'.$this->color;
|
|
}
|
|
|
|
if ($this->size) {
|
|
$classes[] = $this->size;
|
|
}
|
|
|
|
return array(
|
|
'href' => $this->href,
|
|
'class' => $classes,
|
|
);
|
|
}
|
|
|
|
protected function getTagContent() {
|
|
return id(new PHUIIconView())
|
|
->setIcon($this->icon)
|
|
->addClass($this->color);
|
|
}
|
|
|
|
}
|