Commit 98399b66 authored by AdamPS's avatar AdamPS Committed by moshe weitzman
Browse files

Issue #2879341 by AdamPS, ELC, kari.kaariainen: ksm() should not add unnecessary wrapping

parent 56e41afe
......@@ -424,7 +424,18 @@ if (!function_exists('kint')) {
*/
function kint() {
$args = func_get_args();
return \Drupal::service('devel.dumper')->dump($args, NULL, 'kint');
if (count($args) == 1) {
// Pass a single argument directly, which works for any plug-in.
$args = $args[0];
$name = NULL;
}
else {
// Pass an array marked with a special name. The kint plug-in expands the
// arguments and prints each separately.
$name = '__ARGS__';
}
return \Drupal::service('devel.dumper')->dump($args, $name, 'kint');
}
}
......@@ -438,7 +449,18 @@ if (!function_exists('ksm')) {
*/
function ksm() {
$args = func_get_args();
return \Drupal::service('devel.dumper')->message($args, NULL, 'kint');
if (count($args) == 1) {
// Pass a single argument directly, which works for any plug-in.
$args = $args[0];
$name = NULL;
}
else {
// Pass an array marked with a special name. The kint plug-in expands the
// arguments and prints each separately.
$name = '__ARGS__';
}
return \Drupal::service('devel.dumper')->message($args, $name, 'kint');
}
}
......
......@@ -47,7 +47,13 @@ class Kint extends DevelDumperBase {
*/
public function export($input, $name = NULL) {
ob_start();
\Kint::dump($input);
if ($name == '__ARGS__') {
call_user_func_array(['Kint', 'dump'], $input);
$name = NULL;
}
else {
\Kint::dump($input);
}
$dump = ob_get_clean();
// Kint does't allow to assign a title to the dump. Workaround to use the
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment