-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathhelpers.php
105 lines (95 loc) · 2.49 KB
/
helpers.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
<?php
use Illuminate\Support\Facades\View;
if (!function_exists('page_title')) {
/**
* Get formatted page title
*
* @param bool $with_app_name
* @param string $separator
* @return string
*/
function page_title(string $title, bool $withAppName = true, $separator = '-', $invert = false): string
{
if (View::hasSection('title')) {
$title = View::getSection('title');
}
if (!empty($title) && $withAppName) {
if ($invert) {
return $title . " " . trim(e($separator)) . " " . config('app.name');
} else {
return config('app.name') . " " . trim(e($separator)) . " " . $title;
}
} else {
return config('app.name');
}
}
}
if (!function_exists('theme')) {
/**
* Set theme.
*
* @param string $themeName
* @return \Hexadog\ThemesManager\Theme
*/
function theme($themeName = null)
{
if ($themeName) {
\Theme::set($themeName);
}
return \Theme::current();
}
}
if (!function_exists('theme_asset')) {
/**
* Generate an url for the theme asset.
*
* @param string $asset
* @param bool $absolutePath
* @return string
*/
function theme_asset(string $asset, $absolutePath = true)
{
return \Theme::url($asset, $absolutePath);
}
}
if (!function_exists('theme_style')) {
/**
* Generate a secure asset path for the theme asset.
*
* @param string $asset
* @param bool $absolutePath
* @return string
*/
function theme_style(string $asset, $absolutePath = true)
{
return \Theme::style($asset, $absolutePath);
}
}
if (!function_exists('theme_script')) {
/**
* Generate a secure asset path for the theme asset.
*
* @param string $asset
* @param string $mode
* @param bool $absolutePath
* @param string $type
* @param string $level
* @return string
*/
function theme_script(string $asset, string $mode = '', $absolutePath = true, string $type = 'text/javascript', string $level = 'functionality')
{
return \Theme::script($asset, $mode, $absolutePath, $type, $level);
}
}
if (!function_exists('theme_image')) {
/**
* Generate a secure asset path for the theme asset.
*
* @param string $asset
* @return string
*/
function theme_image(string $asset, string $alt = '', string $class = '', array $attributes = [], $absolutePath = true)
{
return \Theme::image($asset, $alt, $class, $attributes, $absolutePath);
}
}