Skip to content

Commit

Permalink
Add Xdebug Link functionality (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
amenk authored and barryvdh committed Aug 17, 2017
1 parent 3c82244 commit 65ad97c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/DebugBar/DataCollector/DataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ public function getDataFormatter()
}

/**
* 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
Expand Down
8 changes: 7 additions & 1 deletion src/DebugBar/Resources/widgets/templates/widget.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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%;
Expand Down
4 changes: 4 additions & 0 deletions src/DebugBar/Resources/widgets/templates/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 65ad97c

Please sign in to comment.