Skip to content

Commit

Permalink
Merge pull request #993 from cakephp/5.x-route-path
Browse files Browse the repository at this point in the history
Add route path for easier use.
  • Loading branch information
markstory authored Mar 4, 2024
2 parents 3afc62e + b611054 commit e3af211
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Panel/RequestPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function shutdown(EventInterface $event): void
}

$this->_data = [
'params' => $request->getAttribute('params'),
'attributes' => $attributes,
'query' => Debugger::exportVarAsNodes($request->getQueryParams(), $maxDepth),
'data' => Debugger::exportVarAsNodes($request->getData(), $maxDepth),
Expand Down
18 changes: 18 additions & 0 deletions templates/element/request_panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* @var \Cake\Error\Debug\NodeInterface $query
* @var \Cake\Error\Debug\NodeInterface $cookie
* @var string $matchedRoute
* @var array $params
*/

use Cake\Error\Debugger;
Expand All @@ -41,6 +42,23 @@
</p>
<?php endif; ?>

<h4>Route path</h4>
<?php
$routePath = $params['controller'] . '::' . $params['action'];
if (!empty($params['prefix'])) {
$routePath = $params['prefix'] . '/' . $routePath;
}
if (!empty($params['plugin'])) {
$routePath = $params['plugin'] . '.' . $routePath;
}
?>
<div class="cake-debug">
<code><?php echo h($routePath); ?></code>
</div>
<p>
<i>[Plugin].[Prefix]/[Controller]::[action]</i>
</p>

<h4>Attributes</h4>
<?php
if (empty($attributes)) :
Expand Down
1 change: 1 addition & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
define('LOGS', TMP);

require_once CORE_PATH . 'config/bootstrap.php';
require_once CAKE . 'functions.php';

date_default_timezone_set('UTC');
mb_internal_encoding('UTF-8');
Expand Down

0 comments on commit e3af211

Please sign in to comment.