Problem/Motivation

I have Kint working as normal and I have added in the Devel Kint Extras module but I am not seeing those 'extras' that I once knew and loved!.

My Kint out out still looks like this...

No extras showing for me

Steps to reproduce

To clarify, I am attempting to Kint a simple Node in a pre-process function using this code...

if (\Drupal::moduleHandler()->moduleExists('devel')) {
    dpm($variables);
  }

And I have set up Devel to use Kint.

I cannot seem to use the kint() functions directly because I get a "Headers already sent" error when I do.

If anyone can help that would be great.

Thanks

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

SirClickALot created an issue. See original summary.

Phil Wolstenholme’s picture

Have you tried ksm (Kint Set Message) instead?

jksloan2974’s picture

StatusFileSize
new134.07 KB
new225.57 KB

I have the same issue with kint extras not showing methods.

ksm

ksm

Hamulus’s picture

the same issue for me: no extras when Kint extended is selected

Phil Wolstenholme’s picture

I ended up using this patch for the Devel module instead of the devel_kint_extras module:

https://raw.githubusercontent.com/politsin/snipets/d7b610a369b24c1dacf07...

The patch isn't my work, it's taken from https://gitlab.com/drupalspoons/devel/-/issues/221#note_430060927

drupalfan2’s picture

Same problem here.

Why it is not possible to use the "Devel Kint Extras" module as in Drupal 8?

And later when the devel patch will be applied? What will be then the best way to debug with kint() (including available methods of the object)?

nitinsp’s picture

Same issue for me, I have install Devel kint Extra module using composer and enable it. Then set Variable dumper as kint extended, but still not able see methods in kint.

Is any other way apart from kint to see methods?

clairedesbois@gmail.com’s picture

Idem for me, the module doesn't work for Drupal 8.9 and Devel 4.1.

If I apply the patch of #5, the memory explodes and the website crashes.

drupalfan2’s picture

Priority: Normal » Critical

This is an essential module!

Why isn't this solved?

clairedesbois@gmail.com’s picture

StatusFileSize
new96.34 KB

I tried something with the patch #5, I add the code to limit the number of depth Kint can display (like the precedent version). Of course, I changed a bit the code comparatively at Devel 2.

After applied the patch #5, you can add in you settings.local.php to prevent memory errors:

include_once(DRUPAL_ROOT . '/vendor/kint-php/kint/src/Kint.php');
if(class_exists('Kint')){
  // Set the maxlevels to prevent out-of-memory. Currently there doesn't seem to be a cleaner way to set this:
  Kint::$max_depth = 4;
}

With that, it works

Screen capture Kint with available methods

drupalfan2’s picture

But this essential module should work without any patch.

laborouge’s picture

+1

drupalfan2’s picture

+1

ash2303’s picture

StatusFileSize
new2.25 KB

Follow below steps:

- Apply patch
- If module is already enabled, disable & enable again (important to set module weight)
- Go to admin/config/development/devel and change Variables Dumper setting to Kint Extended
- Clear Cache

It should work as required.

ash2303’s picture

Status: Active » Needs review
ash2303’s picture

StatusFileSize
new2.25 KB
drupalfan2’s picture

StatusFileSize
new747 bytes

I am using Devel Kint Extras extra module and the correct settings.
But patch #15(#16) does not bring me back the "Available methods" and "Static class properties" sections in the kint() command output.

I am using the following drupal-kint.patch for the devel modul to get this work.

But again:
We need a commited solution for everyone (without need of a patch). Who can take care of it?

ash2303’s picture

If you follow the steps correctly the patch will work fine. Let me know, I will attach a video if required.

drupalfan2’s picture

StatusFileSize
new747 bytes

I am still using this patch. So please do NOT remove it again!

luke adams’s picture

Patch from #17/#19 (they're the same one) is working for me, thanks!

maskedjellybean’s picture

Dang, patch #15 (comment #16) gives me a white screen when I try to use kint() in a Twig template.

Patch #17/19 does not apply. Commenting out code doesn't look like a legitimate way to solve the issue so I'm a bit skeptical of that approach.

maskedjellybean’s picture

I'm sorry, #15/#16 does work! I can see the methods. Thank you so much!

I was overloading Kint and crashing the page. I added this to settings.local.php to fix:

include_once(DRUPAL_ROOT . './../vendor/kint-php/kint/src/Kint.php');
if (class_exists('Kint')) {
  Kint::$max_depth = 3;
}
no sssweat’s picture

The patch from comment #16 works but only when you click the Devel tab. IE: Only when you're the in /devel/node/xxx path.

If you do kint($node); in code, it doesn't show the methods nor static properties.


In contrast, patch from comment #19 will show the methods and static properties when you kint($node); in code. However, should be noted that is patching the devel module rather than the devel_kint_extras module.

khurrami’s picture

Thanks #5 worked for me

DieterHolvoet made their first commit to this issue’s fork.

dieterholvoet’s picture

Status: Needs review » Needs work

The patches from #14 and #16 are not an ideal approach since they are overriding procedural code and especially since it requires re-enabling the module.

The patches from #17/#19 do not belong here, they are to be applied to the Devel module. If you want to take that approach instead of using this module, use this patch from the original issue or post a new patch in the original issue in case it doesn't apply anymore.

I'll update the module description to make it clear that you need to set Kint::$max_depth in order to prevent out-of-memory issues. I'll also provide a fix for this issue in a MR.

dieterholvoet’s picture

Title: No extras showing for me » Extras are not showing when using the king Twig function
Category: Support request » Bug report
Status: Needs work » Needs review
StatusFileSize
new3.02 KB

I fixed the issue. Here's a patch to use for testing in your projects. Make sure the devel patch mentioned earlier in this issue is no longer applied when testing this patch.

dieterholvoet’s picture

Title: Extras are not showing when using the king Twig function » Extras are not showing when using the kint Twig function
Component: Documentation » Code
dieterholvoet’s picture

Assigned: Unassigned » dieterholvoet
Status: Needs review » Needs work

Thinking about it, this only fixes the case where you're using the kint Twig function, not the PHP function. I think an overall better approach would be to override the standard kint plugin instead of introducing a new one. It will allow for simpler code in this module and less workarounds. The only drawback I can think of is that you can't use both the standard and the extended Kint at the same time anymore, although I think that doesn't even work right now. Setting back to Needs work to try out this new approach.

dieterholvoet’s picture

Status: Needs work » Needs review

I proposed automatically overriding the default Kint dumper after enabling the module in #3309491: Override the default kint dumper. Doing that would fix all issues reported here, and the fix would be cleaner than the one that was previously posted here. Feedback is welcome in that issue, especially if you have any objections.

dieterholvoet’s picture

Status: Needs review » Postponed
dieterholvoet’s picture

Status: Postponed » Closed (outdated)

Closing this since #3309491: Override the default kint dumper was merged. I'm transferring credit to that issue.

drupalfan2’s picture

Patch is no longer needet?