-
Notifications
You must be signed in to change notification settings - Fork 6
/
Icon.php
42 lines (35 loc) · 1.25 KB
/
Icon.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace yiichina\icons;
use yii\helpers\Html;
/**
* This is just an example.
*/
class Icon
{
public static function show($name, $options = [], $space = true)
{
return static::fas($name, $options, $space);
}
public static function fas($name, $options = [], $space = true)
{
FontAwesomeAsset::register(\Yii::$app->getView());
Html::addCssClass($options, ['type' =>'fas', 'name' => 'fa-' . $name]);
return Html::tag('i', null, $options) . ($space ? ' ' : null);
}
public static function far($name, $options = [], $space = true)
{
FontAwesomeAsset::register(\Yii::$app->getView());
Html::addCssClass($options, ['type' =>'far', 'name' => 'fa-' . $name]);
return Html::tag('i', null, $options) . ($space ? ' ' : null);
}
public static function fal($name, $options = [], $space = true)
{
return new FontAwesome('fal', $name, $options) . ($space ? ' ' : null);
}
public static function fab($name, $options = [], $space = true)
{
FontAwesomeAsset::register(\Yii::$app->getView());
Html::addCssClass($options, ['type' =>'fab', 'name' => 'fa-' . $name]);
return Html::tag('i', null, $options) . ($space ? ' ' : null);
}
}