diff --git a/modules/cms/classes/Controller.php b/modules/cms/classes/Controller.php index 67a974799..3a0de1479 100644 --- a/modules/cms/classes/Controller.php +++ b/modules/cms/classes/Controller.php @@ -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; // } -} \ No newline at end of file +} diff --git a/modules/cms/classes/Page.php b/modules/cms/classes/Page.php index a51df7695..17199f218 100644 --- a/modules/cms/classes/Page.php +++ b/modules/cms/classes/Page.php @@ -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); } }