forked from zelenin/yii2-semantic-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathElements.php
124 lines (101 loc) · 3.44 KB
/
Elements.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
namespace Zelenin\yii\SemanticUI;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
class Elements
{
public static function icon($icon, $options = [])
{
Html::addCssClass($options, $icon . ' icon');
return Html::tag(ArrayHelper::remove($options, 'tag', 'i'), '', $options);
}
public static function button($content, $options = [])
{
return static::renderElement('button', $content, $options);
}
public static function buttonsGroup($content, $options = [])
{
return static::renderElement('buttons', $content, $options);
}
public static function divider($content = '', $options = [])
{
return static::renderElement('divider', $content, $options);
}
public static function flag($flag, $options = [])
{
Html::addCssClass($options, $flag . ' flag');
return Html::tag(ArrayHelper::remove($options, 'tag', 'i'), '', $options);
}
public static function header($content, $options = [])
{
return static::renderElement('header', $content, $options);
}
public static function image($src, $options = [])
{
Html::addCssClass($options, 'ui ' . ArrayHelper::remove($options, 'class') . ' image');
return Html::img($src, $options);
}
public static function imagesGroup($content, $options = [])
{
return static::renderElement('images', $content, $options);
}
public static function input($content, $options = [])
{
return static::renderElement('input', $content, $options);
}
public static function label($content, $options = [])
{
return static::renderElement('label', $content, $options);
}
public static function labelsGroup($content, $options = [])
{
return static::renderElement('labels', $content, $options);
}
public static function listWrapper($content, $options = [])
{
return static::renderElement('list', $content, $options);
}
public static function listItem($content, $options = [])
{
return static::renderElement('item', $content, $options);
}
public static function dimmer($content, $options = [])
{
return static::renderElement('dimmer', $content, $options);
}
public static function loader($content = '', $options = [])
{
return static::renderElement('loader', $content, $options);
}
public static function rail($content, $options = [])
{
return static::renderElement('rail', $content, $options);
}
public static function reveal($content, $options = [])
{
return static::renderElement('reveal', $content, $options);
}
public static function segment($content, $options = [])
{
return static::renderElement('segment', $content, $options);
}
public static function steps($content, $options = [])
{
return static::renderElement('steps', $content, $options);
}
public static function step($content, $options = [])
{
return static::renderElement('step', $content, $options);
}
/**
* @param string $type
* @param string $content
* @param array $options
* @return string
*/
public static function renderElement($type, $content, $options = [])
{
Html::addCssClass($options, 'ui ' . ArrayHelper::remove($options, 'class') . ' ' . $type);
return Html::tag(ArrayHelper::remove($options, 'tag', 'div'), $content, $options);
}
}