Skip to content
Permalink
Browse files

Fix for issue with dashed routes and vendored plugins

  • Loading branch information...
dakota committed Dec 9, 2015
1 parent 50967f6 commit 1f5c9e7ceb5754343fb018c4a676e4d6469bf641
Showing with 16 additions and 5 deletions.
  1. +16 −5 src/Routing/Route/DashedRoute.php
@@ -34,6 +34,21 @@ class DashedRoute extends Route
*/
protected $_inflectedDefaults = false;
/**
* Camelizes the previously dashed plugin route taking into account plugin vendors
*
* @param string $plugin Plugin name
* @return string
*/
protected function _camelizePlugin($plugin) {
$plugin = str_replace('-', '_', $plugin);
if (strpos($plugin, '/') === false) {
return Inflector::camelize($plugin);
}
list($vendor, $plugin) = explode('/', $plugin, 1);
return Inflector::camelize($vendor) . '/' . Inflector::camelize($plugin);
}
/**
* Parses a string URL into an array. If it matches, it will convert the
* controller and plugin keys to their CamelCased form and action key to
@@ -56,11 +71,7 @@ public function parse($url)
));
}
if (!empty($params['plugin'])) {
$params['plugin'] = Inflector::camelize(str_replace(
'-',
'_',
$params['plugin']
));
$params['plugin'] = $this->_camelizePlugin($params['plugin']);
}
if (!empty($params['action'])) {
$params['action'] = Inflector::variable(str_replace(

0 comments on commit 1f5c9e7

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