3 final class PHUIIconView
extends AphrontTagView
{
5 const SPRITE_TOKENS
= 'tokens';
6 const SPRITE_LOGIN
= 'login';
8 const HEAD_SMALL
= 'phuihead-small';
9 const HEAD_MEDIUM
= 'phuihead-medium';
14 private $headSize = null;
20 private $iconBackground;
24 public function setHref($href) {
29 public function setImage($image) {
30 $this->image
= $image;
34 public function setText($text) {
39 public function setHeadSize($size) {
40 $this->headSize
= $size;
44 public function setSpriteIcon($sprite) {
45 $this->spriteIcon
= $sprite;
49 public function setSpriteSheet($sheet) {
50 $this->spriteSheet
= $sheet;
54 public function setIcon($icon, $color = null) {
55 $this->iconFont
= $icon;
56 $this->iconColor
= $color;
60 public function setColor($color) {
61 $this->iconColor
= $color;
65 public function getIconName() {
66 return $this->iconFont
;
69 public function setBackground($color) {
70 $this->iconBackground
= $color;
74 public function setTooltip($text) {
75 $this->tooltip
= $text;
79 public function setEmblemColor($emblem_color) {
80 $this->emblemColor
= $emblem_color;
84 public function getEmblemColor() {
85 return $this->emblemColor
;
88 protected function getTagName() {
96 protected function getTagAttributes() {
97 require_celerity_resource('phui-icon-view-css');
100 $classes[] = 'phui-icon-view';
101 if ($this->spriteIcon
) {
102 require_celerity_resource('sprite-'.$this->spriteSheet
.'-css');
103 $classes[] = 'sprite-'.$this->spriteSheet
;
104 $classes[] = $this->spriteSheet
.'-'.$this->spriteIcon
;
105 } else if ($this->iconFont
) {
106 require_celerity_resource('phui-font-icon-base-css');
107 require_celerity_resource('font-fontawesome');
108 $classes[] = 'phui-font-fa';
109 $classes[] = $this->iconFont
;
110 if ($this->iconColor
) {
111 $classes[] = $this->iconColor
;
113 if ($this->iconBackground
) {
114 $classes[] = 'phui-icon-square';
115 $classes[] = $this->iconBackground
;
118 if ($this->headSize
) {
119 $classes[] = $this->headSize
;
121 $style = 'background-image: url('.$this->image
.');';
124 $classes[] = 'phui-icon-has-text';
125 $this->appendChild($this->text
);
128 if ($this->emblemColor
) {
129 $classes[] = 'phui-icon-emblem phui-icon-emblem-'.$this->emblemColor
;
134 if ($this->tooltip
) {
135 Javelin
::initBehavior('phabricator-tooltips');
136 require_celerity_resource('aphront-tooltip-css');
137 $sigil = 'has-tooltip';
139 'tip' => $this->tooltip
,
144 'href' => $this->href
,
153 public static function getSheetManifest($sheet) {
154 $root = dirname(phutil_get_library_root('phabricator'));
155 $path = $root.'/resources/sprite/manifest/'.$sheet.'.json';
156 $data = Filesystem
::readFile($path);
157 return idx(phutil_json_decode($data), 'sprites');
160 public static function getIcons() {
187 'fa-arrow-circle-o-down',
188 'fa-arrow-circle-o-up',
226 'fa-pencil-square-o',
246 'fa-question-circle',
262 'fa-exclamation-circle',
268 'fa-exclamation-triangle',
284 'fa-facebook-square',
294 'fa-linkedin-square',
320 'fa-arrow-circle-left',
321 'fa-arrow-circle-right',
322 'fa-arrow-circle-up',
323 'fa-arrow-circle-down',
348 'fa-pinterest-square',
349 'fa-google-plus-square',
390 'fa-angle-double-left',
391 'fa-angle-double-right',
392 'fa-angle-double-up',
393 'fa-angle-double-down',
435 'fa-microphone-slash',
438 'fa-fire-extinguisher',
441 'fa-chevron-circle-left',
442 'fa-chevron-circle-right',
443 'fa-chevron-circle-up',
444 'fa-chevron-circle-down',
461 'fa-external-link-square',
464 'fa-caret-square-o-down',
465 'fa-caret-square-o-up',
466 'fa-caret-square-o-right',
478 'fa-sort-alpha-desc',
479 'fa-sort-amount-asc',
480 'fa-sort-amount-desc',
481 'fa-sort-numeric-asc',
482 'fa-sort-numeric-desc',
496 'fa-bitbucket-square',
499 'fa-long-arrow-down',
501 'fa-long-arrow-left',
502 'fa-long-arrow-right',
523 'fa-arrow-circle-o-right',
524 'fa-arrow-circle-o-left',
525 'fa-caret-square-o-left',
533 'fa-envelope-square',
545 'fa-stumbleupon-circle',
549 'fa-pied-piper-square',
579 'fa-file-powerpoint-o',
613 'fa-share-alt-square',
668 'fa-cart-arrow-down',
679 'fa-transgender-alt',
687 'fa-facebook-official',
700 'fa-y-combinator-square',
711 'fa-battery-three-quarters',
715 'fa-battery-quarter',
730 'fa-hourglass-start',
740 'fa-hand-scissors-o',
747 'fa-creative-commons',
752 'fa-odnoklassniki-square',
759 'fa-internet-explorer',
765 'fa-calendar-plus-o',
766 'fa-calendar-minus-o',
767 'fa-calendar-times-o',
768 'fa-calendar-check-o',
782 'fa-credit-card-alt',
783 'fa-codiepie:before',
795 'fa-shopping-basket',
804 'fa-universal-access',
806 'fa-question-circle-o',
808 'fa-audio-description',
809 'fa-volume-control-phone',
811 'fa-assistive-listening-systems',
812 'fa-asl-interpreting',
813 'fa-american-sign-language-interpreting',
815 'fa-hard-of-hearing',
826 'fa-snapchat-square',
830 'fa-google-plus-circle',
831 'fa-google-plus-official',
836 'fa-envelope-open-o',
848 'fa-drivers-license',
850 'fa-drivers-license-o',
857 'fa-thermometer-full',
859 'fa-thermometer-three-quarters',
861 'fa-thermometer-half',
863 'fa-thermometer-quarter',
865 'fa-thermometer-empty',
871 'fa-window-maximize',
872 'fa-window-minimize',
874 'fa-times-rectangle',
876 'fa-times-rectangle-o',
893 public static function getIconColors() {