diff --git a/CHANGELOG.md b/CHANGELOG.md index a6f2853..cdfc40f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ All notable changes to this project will be documented in this file, in reverse - [#217](https://github.com/zendframework/ZendDeveloperTools/pull/217) adds support in the `SerializableException` for PHP 7 Throwables, including Error types. +- [#220](https://github.com/zendframework/ZendDeveloperTools/pull/220) adds + support for displaying matched route parameters other than just the controller + and action. ### Deprecated diff --git a/src/Collector/RequestCollector.php b/src/Collector/RequestCollector.php index f1fee21..42fd4ab 100644 --- a/src/Collector/RequestCollector.php +++ b/src/Collector/RequestCollector.php @@ -71,7 +71,10 @@ public function collect(MvcEvent $mvcEvent) 'status' => $mvcEvent->getResponse()->getStatusCode(), 'route' => ($match === null) ? 'N/A' : $match->getMatchedRouteName(), 'action' => ($match === null) ? 'N/A' : $match->getParam('action', 'N/A'), - 'controller' => ($match === null) ? 'N/A' : $match->getParam('controller', 'N/A') + 'controller' => ($match === null) ? 'N/A' : $match->getParam('controller', 'N/A'), + 'other_route_parameters' => ($match === null) ? 'N/A' : array_filter($match->getParams(), function ($key) { + return ! in_array($key, ['action', 'controller']); + }, ARRAY_FILTER_USE_KEY), ]; } @@ -141,6 +144,15 @@ public function getControllerName() return $this->data['controller']; } + /** + * Returns parameters except controller and actions + * @return array + */ + public function getOtherParameters() + { + return $this->data['other_route_parameters']; + } + /** * Returns the controller and action name if possible, otherwise N/A. * diff --git a/view/zend-developer-tools/toolbar/request.phtml b/view/zend-developer-tools/toolbar/request.phtml index 2ecbc4e..87f52b2 100644 --- a/view/zend-developer-tools/toolbar/request.phtml +++ b/view/zend-developer-tools/toolbar/request.phtml @@ -18,25 +18,29 @@ $color = ($statusCode < 400)
- + Status code - + Method collector->getMethod(); ?> - + Controller collector->getControllerName(); ?> - + Action collector->getActionName(); ?> - + + Other Route Parameters + collector->getOtherParameters() ); ?> + + Route collector->getRouteName(); ?>