mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Allow routing to nothing without looking up from the Request object
This commit is contained in:
parent
a2fba71c7f
commit
63b98f56c5
@ -61,7 +61,7 @@ class BackendController extends ControllerBase
|
||||
if ($controllerObj = $this->findController($controllerClass, $action, Config::get('cms.pluginsDir', '/plugins')))
|
||||
return $controllerObj->run($action, $controllerParams);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Fall back on Cms controller
|
||||
*/
|
||||
|
@ -106,9 +106,9 @@ class Controller extends BaseController
|
||||
* If the parameter is omitted, the current URL used.
|
||||
* @return string Returns the processed page content.
|
||||
*/
|
||||
public function run($url = null)
|
||||
public function run($url = '/')
|
||||
{
|
||||
if (!$url)
|
||||
if ($url === null)
|
||||
$url = Request::path();
|
||||
|
||||
if (!strlen($url))
|
||||
@ -690,8 +690,13 @@ class Controller extends BaseController
|
||||
if ($routePersistence)
|
||||
$parameters = array_merge($this->router->getParameters(), $parameters);
|
||||
|
||||
$url = $this->router->findByFile($name, $parameters);
|
||||
return ($url) ? URL::to($url) : null;
|
||||
if (!$url = $this->router->findByFile($name, $parameters))
|
||||
return null;
|
||||
|
||||
if (substr($url, 0, 1) == '/')
|
||||
$url = substr($url, 1);
|
||||
|
||||
return URL::action('Cms\Classes\Controller@run', ['slug' => $url]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user