diff --git a/src/Application/Routers/Route.php b/src/Application/Routers/Route.php index 41ab31c1d..af1a7909e 100644 --- a/src/Application/Routers/Route.php +++ b/src/Application/Routers/Route.php @@ -291,6 +291,7 @@ public function constructUrl(Application\Request $appRequest, Nette\Http\Url $re if ($params === NULL) { return NULL; } + $presenter = $params[self::PRESENTER_KEY]; } if (isset($metadata[self::MODULE_KEY])) { // try split into module and [submodule:]presenter parts diff --git a/tests/Routers/Route.filter.global.phpt b/tests/Routers/Route.filter.global.phpt index f09a8f453..854fbd5e0 100644 --- a/tests/Routers/Route.filter.global.phpt +++ b/tests/Routers/Route.filter.global.phpt @@ -42,3 +42,26 @@ testRouteIn($route, '/abc?param=1', 'Abc.in', [ testRouteIn($route, '/cde?param=1'); \Tester\Assert::null(testRouteOut($route, 'Cde')); + + +$route = new Route('//', [ + NULL => [ + Route::FILTER_IN => function (array $arr) { + $arr['presenter'] = substr($arr['presenter'], 0, -2); // App:AbcCs -> App:Abc + $arr['action'] = substr($arr['action'], 0, -2); + return $arr; + }, + Route::FILTER_OUT => function (array $arr) { + $arr['presenter'] .= ucfirst($arr['lang']); // App:Abc -> App:AbcCs + $arr['action'] .= ucfirst($arr['lang']); + return $arr; + }, + ], + 'module' => 'App' +]); + + +testRouteIn($route, '/cs/abc-cs/def-cs', 'App:Abc', ['lang' => 'cs', 'action' => 'def', 'test' => 'testvalue'], '/cs/abc-cs/def-cs?test=testvalue'); + +Assert::same('http://example.com/cs/abc-cs/def-cs?test=testvalue', testRouteOut($route, 'App:Abc', ['lang' => 'cs', 'action' => 'def', 'test' => 'testvalue'])); +