Skip to content
Permalink
Browse files

Updated routes.php so routes default routes only take the route param…

…eter patterns they need.
  • Loading branch information...
sam-at-github committed Feb 13, 2014
1 parent a554ac4 commit 37fd8dcc5527a900a40af4a0d0e23bda140908cd
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/Config/routes.php
@@ -51,23 +51,25 @@
}
$pluginPattern = implode('|', $plugins);
$indexParams = ['action' => 'index'];
$match = ['prefix' => $prefixPattern, 'plugin' => $pluginPattern];
$pluginShortMatch = $match + [
$pluginShortMatch = [
'routeClass' => 'Cake\Routing\Route\PluginShortRoute',
'_name' => '_plugin._controller:index'
];
if ($prefixPattern && $pluginPattern) {
Router::connect('/:prefix/:plugin', $indexParams, $pluginShortMatch);
$match = ['prefix' => $prefixPattern, 'plugin' => $pluginPattern];
Router::connect('/:prefix/:plugin', $indexParams, $match + $pluginShortMatch);
Router::connect('/:prefix/:plugin/:controller', $indexParams, $match);
Router::connect('/:prefix/:plugin/:controller/:action/*', [], $match);
}
if ($pluginPattern) {
Router::connect('/:plugin', $indexParams, $pluginShortMatch);
$match = ['plugin' => $pluginPattern];
Router::connect('/:plugin', $indexParams, $match + $pluginShortMatch);
Router::connect('/:plugin/:controller', $indexParams, $match);
Router::connect('/:plugin/:controller/:action/*', [], $match);
}
if ($prefixPattern) {
$match = ['prefix' => $prefixPattern];
Router::connect('/:prefix/:controller', $indexParams, $match);
Router::connect('/:prefix/:controller/:action/*', [], $match);
}

0 comments on commit 37fd8dc

Please sign in to comment.
You can’t perform that action at this time.