Merge pull request #611 from nnmer/master

Additional parameters for some methods to be able to specify whether  needed absolute or relative path for the url generator
This commit is contained in:
Samuel Georges 2014-09-18 08:21:14 +10:00
commit 76aed53ec8
2 changed files with 6 additions and 5 deletions

View File

@ -807,10 +807,11 @@ class Controller extends BaseController
* @param mixed $name Specifies the Cms Page file name.
* @param array $parameters Route parameters to consider in the URL.
* @param bool $routePersistence By default the existing routing parameters will be included
* @param bool $absolute If True - create absolute URL path, if False - create relative URL path
* when creating the URL, set to false to disable this feature.
* @return string
*/
public function pageUrl($name, $parameters = [], $routePersistence = true)
public function pageUrl($name, $parameters = [], $routePersistence = true, $absolute = true)
{
if (!$name)
return null;
@ -832,7 +833,7 @@ class Controller extends BaseController
if (substr($url, 0, 1) == '/')
$url = substr($url, 1);
return URL::action('Cms\Classes\Controller@run', ['slug' => $url]);
return URL::action('Cms\Classes\Controller@run', ['slug' => $url], $absolute);
}
/**
@ -1001,4 +1002,4 @@ class Controller extends BaseController
// return null;
// }
}
}

View File

@ -92,9 +92,9 @@ class Page extends CmsCompoundObject
* Helper that makes a URL for a page in the active theme.
* @return string
*/
public static function url($page, $params = [])
public static function url($page, $params = [], $absolute = true)
{
$controller = new Controller;
return $controller->pageUrl($page, $params);
return $controller->pageUrl($page, $params, true, $absolute);
}
}