mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 00:37:52 +00:00
[FEATURE]
- Added support for custom ExceptionHandlers on group level. - Routes now contain parent group, if any. - Fixed wrong usage of required parameter.
This commit is contained in:
@@ -39,12 +39,16 @@ class RouterBase {
|
||||
}
|
||||
}
|
||||
|
||||
protected function processRoutes(array $routes, array $settings = array(), array $prefixes = array(), $backstack = false) {
|
||||
protected function processRoutes(array $routes, array $settings = array(), array $prefixes = array(), $backstack = false, $group = null) {
|
||||
// Loop through each route-request
|
||||
|
||||
$activeGroup = null;
|
||||
|
||||
/* @var $route RouterEntry */
|
||||
foreach($routes as $route) {
|
||||
|
||||
$route->setGroup($group);
|
||||
|
||||
if($this->defaultNamespace && !$route->getNamespace()) {
|
||||
$namespace = null;
|
||||
if ($route->getNamespace()) {
|
||||
@@ -75,6 +79,7 @@ class RouterBase {
|
||||
$this->currentRoute = $route;
|
||||
if($route instanceof RouterGroup && is_callable($route->getCallback())) {
|
||||
$route->renderRoute($this->request);
|
||||
$activeGroup = $route;
|
||||
}
|
||||
$this->currentRoute = null;
|
||||
|
||||
@@ -83,7 +88,7 @@ class RouterBase {
|
||||
$this->backstack = array();
|
||||
|
||||
// Route any routes added to the backstack
|
||||
$this->processRoutes($backstack, $mergedSettings, $newPrefixes, true);
|
||||
$this->processRoutes($backstack, $mergedSettings, $newPrefixes, true, $activeGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user