Skip to content

Commit e3af211

Browse files
authored
Merge pull request #993 from cakephp/5.x-route-path
Add route path for easier use.
2 parents 3afc62e + b611054 commit e3af211

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

src/Panel/RequestPanel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public function shutdown(EventInterface $event): void
4949
}
5050

5151
$this->_data = [
52+
'params' => $request->getAttribute('params'),
5253
'attributes' => $attributes,
5354
'query' => Debugger::exportVarAsNodes($request->getQueryParams(), $maxDepth),
5455
'data' => Debugger::exportVarAsNodes($request->getData(), $maxDepth),

templates/element/request_panel.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* @var \Cake\Error\Debug\NodeInterface $query
2525
* @var \Cake\Error\Debug\NodeInterface $cookie
2626
* @var string $matchedRoute
27+
* @var array $params
2728
*/
2829

2930
use Cake\Error\Debugger;
@@ -41,6 +42,23 @@
4142
</p>
4243
<?php endif; ?>
4344

45+
<h4>Route path</h4>
46+
<?php
47+
$routePath = $params['controller'] . '::' . $params['action'];
48+
if (!empty($params['prefix'])) {
49+
$routePath = $params['prefix'] . '/' . $routePath;
50+
}
51+
if (!empty($params['plugin'])) {
52+
$routePath = $params['plugin'] . '.' . $routePath;
53+
}
54+
?>
55+
<div class="cake-debug">
56+
<code><?php echo h($routePath); ?></code>
57+
</div>
58+
<p>
59+
<i>[Plugin].[Prefix]/[Controller]::[action]</i>
60+
</p>
61+
4462
<h4>Attributes</h4>
4563
<?php
4664
if (empty($attributes)) :

tests/bootstrap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
define('LOGS', TMP);
4444

4545
require_once CORE_PATH . 'config/bootstrap.php';
46+
require_once CAKE . 'functions.php';
4647

4748
date_default_timezone_set('UTC');
4849
mb_internal_encoding('UTF-8');

0 commit comments

Comments
 (0)