It would be nice to make Kint minimally configurable. I wrote a patch to make configurable some Kint's properties:

  • theme (Kint skin)
  • maxLevels (Max array/object levels to go deep)
  • displayCalledFrom (Whether to display where kint was called from)
  • maxStrLength (Max length of string before it is truncated)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

willzyx’s picture

willzyx’s picture

willzyx’s picture

Looks like part of the patch (config schema/install) was missed in the last reroll.. Complete patch attached

Status: Needs review » Needs work

The last submitted patch, 3: devel-kint-config-2405179-3.patch, failed testing.

Status: Needs work » Needs review
moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

Looks fine to me.

moshe weitzman’s picture

Looks fine to me.

willzyx’s picture

willzyx’s picture

Status: Reviewed & tested by the community » Postponed
esolitos’s picture

Since Issue #2191395 is solved, should this be not postponed anymore?

willzyx’s picture

Status: Postponed » Needs work

Now that the pluggable dumper system is in the patch in #3 is not valid anymore.. we need to create a generic way to configure dumper plugins

Anybody’s picture

Yes this issue should definitely be brought back to life... setting "maxLevels" is for example essential to make theme debugging work for larger objects / arrays!
It's not a good solution to HACK the devel module to set that variable!

xaqrox’s picture

Title: Make Kint configurable » Make dumper plugins (Kint, etc.) configurable

I would like to help push this forward. Here's what I'm thinking thus far, but I am new to D8's OOP intensity, could someone (@willzyx?) let me know if I'm on the right track?

  1. DevelDumperInterface needs some way to declare its settings.
  2. The devel settings form should detect which dumper is chosen and AJAX in the appropriate form elements.
  3. The devel settings form should save the dumper settings somewhere (devel.settings.dumper?).
  4. Dumper implementations should have a way to access their settings.

I'm just not sure how to accomplish all these things. Should DevelDumperInterface have a function returning the names and defaults of configurable settings? Should it also return a form to edit those settings? Where/how do the dumper settings get saved, and how does the implementation access them? Any hints?

lussoluca’s picture

Hi xaqrox,
interesting idea.
You could look at other configurable plugin systems, like the Block one.

Maybe you can start posting some initial patches, then I'll available to review them.

Marko B’s picture

I would be happy if we just have config option to set in settings.php as this is dev thing, this should be enough so think something like this would be good.

in settings.local.php
$settings['kint_level_depth'] = '20';

then
use Drupal\Core\Site\Settings;
$some_kint_var= settings::get('kint_level_depth', '10') ;

should be enough right?

leymannx’s picture

I like this approach due to its minimalistic intervention. So I patched kint/kint/config.default.php although it doesn't look like as if there should happen much Drupal inside. But where else?

Now the following could be added to settings.php:

$settings['kint_maxLevels'] = '4';
$settings['kint_maxStrLength'] = '120';
// ...
Anybody’s picture

Thats at least a starting point... is kint installed via composer or part of devel? Then such a change can be done...

leymannx’s picture

It had its own branch 8.x-1.x-kint opened in 2014 but never updated since. Seems it got added back into the 8.x-1.x branch in the same year and only touched once, in 2016. See http://cgit.drupalcode.org/devel/log/kint/kint?h=8.x-1.x

So Kint probably should be a thing on its own and we probably shouldn't put that Settings code in the config.default.php BUT in a duplicated config.php instead. Which on the other hand gets ignored via kint/kint/.gitignore. Maybe we should unignore config.php?

Would like to hear what the others think about it.

leymannx’s picture

I also like @Anybody's approach from https://gist.github.com/JPustkuchen/a5f1eaeb7058856b7ef087b028ffdfeb. If you only use it locally anyways, why not. Minimal intervention. Maximum effect. Simply put the following snippet in your settings.php. No patches needed.

// Change kint maxLevels setting:
include_once(DRUPAL_ROOT . '/modules/contrib/devel/kint/kint/Kint.class.php');
if (class_exists('Kint')){
  // Set the maxlevels to prevent out-of-memory.
  Kint::$maxLevels = 4;
}
Marko B’s picture

Ok, then at least we should add that info in readme file of kint so people know how to set it up.

moshe weitzman’s picture

Kint project was updated (finally!) and in our 3.x branch its brought in as a composer dependency. Memory issues are gone I think.

moshe weitzman’s picture

Status: Needs review » Closed (duplicate)

This issue has been migrated to DrupalSpoons. Its new URL is https://gitlab.com/drupalspoons/devel/-/issues/261.

Marko B’s picture

Moshe, how is migration of issues done, is it manual or is there some automatic way to do that? Also how do you think to manage future issues that come to d.org and redirect users to go to gitlab?