forked from orchestral/orchestra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers.php
45 lines (39 loc) · 808 Bytes
/
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
<?php
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);
}
}