Completed
Pull Request — master (#5)
by ARCANEDEV
03:20
created

helpers.php ➔ ui_link()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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