diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2020-04-26 15:41:48 +0200 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2020-04-26 15:41:48 +0200 |
commit | 53e6d5fde32a917718a0658fb95f366dc7dfc248 (patch) | |
tree | 6510be3ee713a444a477aef8faf60a62fb47b165 /app/class/Controller.php | |
parent | 0efeef6b6693d62675ec8a45e73c71f69e0a0362 (diff) | |
download | wcms-53e6d5fde32a917718a0658fb95f366dc7dfc248.tar.gz wcms-53e6d5fde32a917718a0658fb95f366dc7dfc248.zip |
user bookmarks use new object
+ shortcuts visible in backtopbar
Diffstat (limited to 'app/class/Controller.php')
-rw-r--r-- | app/class/Controller.php | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/class/Controller.php b/app/class/Controller.php index 34b3d11..46c9ee0 100644 --- a/app/class/Controller.php +++ b/app/class/Controller.php @@ -46,8 +46,8 @@ class Controller { $router = $this->router; $this->plates = new Engine(Model::TEMPLATES_DIR); - $this->plates->registerFunction('url', function (string $string, array $vars = []) { - return $this->generate($string, $vars); + $this->plates->registerFunction('url', function (string $string, array $vars = [], string $get = '') { + return $this->generate($string, $vars, $get); }); $this->plates->registerFunction('upage', function (string $string, string $id) { return $this->generate($string, ['page' => $id]); @@ -79,13 +79,14 @@ class Controller * * @param string $route The name of the route. * @param array $params Associative array of parameters to replace placeholders with. + * @param string $get Optionnal query GET parameters formated * @return string The URL of the route with named parameters in place. * @throws InvalidArgumentException If the route does not exist. */ - public function generate(string $route, array $params = []): string + public function generate(string $route, array $params = [], string $get = ''): string { try { - return $this->router->generate($route, $params); + return $this->router->generate($route, $params) . $get; } catch (Exception $e) { throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); } |