Completed
Push — master ( 6c8e3d...490079 )
by ARCANEDEV
9s
created

helpers.php ➔ ui_link_icon()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 4
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
use Arcanesoft\Core\Helpers\UI\Button;
4
use Arcanesoft\Core\Helpers\UI\Label;
5
use Arcanesoft\Core\Helpers\UI\Link;
6
7
/* -----------------------------------------------------------------
8
 |  Buttons
9
 | -----------------------------------------------------------------
10
 */
11
12
if ( ! function_exists('ui_button')) {
13
    /**
14
     * Generate a link.
15
     *
16
     * @param  string  $action
17
     * @param  string  $type
18
     * @param  array   $attributes
19
     * @param  bool    $disabled
20
     *
21
     * @return \Arcanesoft\Core\Helpers\UI\Button
22
     */
23
    function ui_button($action, $type = 'button', array $attributes = [], $disabled = false) {
24
        return Button::make($action, $type, $attributes, $disabled)
25
                     ->size('sm');
26
    }
27
}
28
29
if ( ! function_exists('ui_button_icon')) {
30
    /**
31
     * Generate a small icon link.
32
     *
33
     * @param  string  $action
34
     * @param  string  $type
35
     * @param  array   $attributes
36
     * @param  bool    $disabled
37
     *
38
     * @return \Arcanesoft\Core\Helpers\UI\Button
39
     */
40
    function ui_button_icon($action, $type = 'button', array $attributes = [], $disabled = false) {
41
        return Button::make($action, $type, $attributes, $disabled)
42
                     ->withTooltip(true)
43
                     ->size('xs');
44
    }
45
}
46
47
/* -----------------------------------------------------------------
48
 |  Labels
49
 | -----------------------------------------------------------------
50
 */
51
52
if ( ! function_exists('label_active_icon')) {
53
    /**
54
     * Generate active icon label.
55
     *
56
     * @param  bool   $active
57
     * @param  array  $options
58
     * @param  bool   $withTooltip
59
     *
60
     * @return \Illuminate\Support\HtmlString
61
     */
62
    function label_active_icon($active, array $options = [], $withTooltip = true) {
63
        return Label::activeIcon($active, $options, $withTooltip);
64
    }
65
}
66
67
if ( ! function_exists('label_active_status')) {
68
    /**
69
     * Generate active status label.
70
     *
71
     * @param  bool   $active
72
     * @param  array  $options
73
     * @param  bool   $withIcon
74
     *
75
     * @return \Illuminate\Support\HtmlString
76
     */
77
    function label_active_status($active, array $options = [], $withIcon = true) {
78
        return Label::activeStatus($active, $options, $withIcon);
79
    }
80
}
81
82
if ( ! function_exists('label_count')) {
83
    /**
84
     * Generate count label.
85
     *
86
     * @param  int|float  $count
87
     * @param  array      $options
88
     *
89
     * @return Illuminate\Support\HtmlString
90
     */
91
    function label_count($count, array $options = []) {
92
        return Label::count($count, $options);
93
    }
94
}
95
96
if ( ! function_exists('label_locked_icon')) {
97
    /**
98
     * Generate locked icon label.
99
     *
100
     * @param  bool   $locked
101
     * @param  array  $options
102
     * @param  bool   $withTooltip
103
     *
104
     * @return \Illuminate\Support\HtmlString
105
     */
106
    function label_locked_icon($locked, array $options = [], $withTooltip = true) {
107
        return Label::lockedIcon($locked, $options, $withTooltip);
108
    }
109
}
110
111
if ( ! function_exists('label_locked_status')) {
112
    /**
113
     * Generate locked status label.
114
     *
115
     * @param  bool   $locked
116
     * @param  array  $options
117
     * @param  bool   $withIcon
118
     *
119
     * @return \Illuminate\Support\HtmlString
120
     */
121
    function label_locked_status($locked, array $options = [], $withIcon = true) {
122
        return Label::lockedStatus($locked, $options, $withIcon);
123
    }
124
}
125
126
if ( ! function_exists('label_trashed_status')) {
127
    /**
128
     * Generate trashed status label.
129
     *
130
     * @param  array  $options
131
     * @param  bool   $withIcon
132
     *
133
     * @return \Illuminate\Support\HtmlString
134
     */
135
    function label_trashed_status(array $options = [], $withIcon = true) {
136
        return Label::trashedStatus($options, $withIcon);
137
    }
138
}
139
140
/* -----------------------------------------------------------------
141
 |  Links
142
 | -----------------------------------------------------------------
143
 */
144
145
if ( ! function_exists('ui_link')) {
146
    /**
147
     * Generate a link.
148
     *
149
     * @param  string  $action
150
     * @param  string  $url
151
     * @param  array   $attributes
152
     * @param  bool    $disabled
153
     *
154
     * @return \Arcanesoft\Core\Helpers\UI\Link
155
     */
156
    function ui_link($action, $url, array $attributes = [], $disabled = false) {
157
        return Link::make($action, $url, $attributes, $disabled)->size('sm');
158
    }
159
}
160
161
if ( ! function_exists('ui_link_icon')) {
162
    /**
163
     * Generate a small icon link.
164
     *
165
     * @param  string  $action
166
     * @param  string  $url
167
     * @param  array   $attributes
168
     * @param  bool    $disabled
169
     *
170
     * @return \Arcanesoft\Core\Helpers\UI\Link
171
     */
172
    function ui_link_icon($action, $url, array $attributes = [], $disabled = false) {
173
        return Link::make($action, $url, $attributes, $disabled)
174
                   ->withTooltip(true)
175
                   ->size('xs');
176
    }
177
}
178