forked from orchestral/orchestra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers.php
61 lines (54 loc) · 1.14 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
<?php
if ( ! function_exists('theme_path'))
{
/**
* Return theme path
*
* @see Orchestra\Theme::path()
* @param string $view
* @return string
*/
function theme_path($view)
{
$theme = Orchestra\View::$theme;
return IoC::resolve("orchestra.theme: {$theme}")->path($view);
}
}
if ( ! function_exists('handles'))
{
/**
* Return handles configuration for a bundle
*
* @param string $bundle Bundle name
* @return string URL path
*/
function handles($name)
{
$handles = '';
if (strpos($name, '::') !== false)
{
list($bundle, $to) = Bundle::parse($name);
}
else
{
$bundle = $name;
$to = '';
}
// In situation where bundle is not registered, it best to assume
// that we are handle "application" routing
if ( ! Bundle::exists($bundle))
{
$bundle = DEFAULT_BUNDLE;
$to = $bundle;
// DEFAULT_BUNDLE should handle root path
$handles = '';
}
else
{
$handles = Bundle::option($bundle, 'handles');
$handles = rtrim($handles, '/');
}
$to = ltrim($to, '/');
return url($handles.'/'.$to);
}
}