1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-01-16 21:08:34 +01:00

Add Xdebug Link functionality (#303)

https://github.com/barryvdh/laravel-debugbar/issues/566
This commit is contained in:
Alexander Menk 2017-08-17 09:15:24 +02:00 committed by Barry vd. Heuvel
parent 3c82244dff
commit 65ad97c307
3 changed files with 23 additions and 1 deletions

View File

@ -72,6 +72,18 @@ abstract class DataCollector implements DataCollectorInterface
}
/**
* Get an Xdebug Link to a file
*
* @return string|null
*/
public function getXdebugLink($file, $line = 1)
{
if (ini_get('xdebug.file_link_format') || extension_loaded('xdebug')) {
return e(str_replace(array('%f', '%l'), array($file, $line), ini_get('xdebug.file_link_format')));
}
}
/**
* Sets the default variable dumper used by all collectors subclassing this class
*
* @param DebugBarVarDumper $varDumper

View File

@ -25,7 +25,9 @@ div.phpdebugbar-widgets-templates div.phpdebugbar-widgets-status span.phpdebugba
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-render-time:before,
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-memory:before,
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-param-count:before,
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-type:before {
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-type:before,
div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before
{
font-family: PhpDebugbarFontAwesome;
margin-right: 4px;
font-size: 12px;
@ -42,6 +44,10 @@ div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-param-count:before {
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-type:before {
content: "\f121";
}
div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before {
content: "\f08e";
margin-left: 4px;
}
div.phpdebugbar-widgets-templates table.phpdebugbar-widgets-params {
display: none;
width: 70%;

View File

@ -17,6 +17,10 @@
this.$list = new PhpDebugBar.Widgets.ListWidget({ itemRenderer: function(li, tpl) {
$('<span />').addClass(csscls('name')).text(tpl.name).appendTo(li);
if (typeof tpl.xdebug_link != 'undefined') {
$('<a href="' + tpl.xdebug_link + '"></a>').addClass(csscls('editor-link')).appendTo(li);
}
if (tpl.render_time_str) {
$('<span title="Render time" />').addClass(csscls('render-time')).text(tpl.render_time_str).appendTo(li);
}