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

Use xdebug_link in html variables (#609)

This commit is contained in:
Barry vd. Heuvel 2024-03-01 16:24:55 +01:00 committed by GitHub
parent b6113ae0e5
commit d420dd09d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 4 deletions

View File

@ -59,7 +59,10 @@ class ObjectCountCollector extends DataCollector implements DataCollectorInterfa
$reflector = class_exists($class) ? new \ReflectionClass($class) : null;
if ($reflector && $link = $this->getXdebugLink($reflector->getFileName())) {
$data[$class . '<a href="' . $link['url'] . '" class="phpdebugbar-widgets-editor-link"></a>'] = $count;
$data[$class] = [
'value' => $count,
'xdebug_link' => $link,
];
} else {
$data[$class] = $count;
}

View File

@ -31,6 +31,7 @@ pre.phpdebugbar-widgets-code-block {
text-align: right;
}
.phpdebugbar-widgets-kvlist span.phpdebugbar-widgets-filename,
li.phpdebugbar-widgets-list-item span.phpdebugbar-widgets-filename {
display: block;
font-style: italic;
@ -39,7 +40,7 @@ pre.phpdebugbar-widgets-code-block {
color: #888;
}
li.phpdebugbar-widgets-list-item a.phpdebugbar-widgets-editor-link:hover {
a.phpdebugbar-widgets-editor-link:hover {
color: #aaaaaa;
}

View File

@ -218,7 +218,7 @@ if (typeof(PhpDebugBar) == 'undefined') {
itemRenderer: function(dt, dd, key, value) {
$('<span />').attr('title', key).text(key).appendTo(dt);
var v = value;
var v = value && value.value || value;
if (v && v.length > 100) {
v = v.substr(0, 100) + "...";
}
@ -251,7 +251,21 @@ if (typeof(PhpDebugBar) == 'undefined') {
itemRenderer: function(dt, dd, key, value) {
$('<span />').attr('title', $('<i />').html(key || '').text()).html(key || '').appendTo(dt);
dd.html(value);
dd.html(value && value.value || value);
if (value && value.xdebug_link) {
var header = $('<span />').addClass(csscls('filename')).text(value.xdebug_link.filename + ( value.xdebug_link.line ? "#" + value.xdebug_link.line : ''));
if (value.xdebug_link) {
if (value.xdebug_link.ajax) {
$('<a title="' + value.xdebug_link.url + '"></a>').on('click', function () {
$.ajax(value.xdebug_link.url);
}).addClass(csscls('editor-link')).appendTo(header);
} else {
$('<a href="' + value.xdebug_link.url + '"></a>').addClass(csscls('editor-link')).appendTo(header);
}
}
header.appendTo(dd);
}
}
});