Currently devel doesn't allow to override KINT configuration in a clean way. Hopefully this will be possible some day via setting in UI or drupal setting override in settings.php Until this happens you may use this dirty trick in settings.php to override the setting.
See issues:
- https://www.drupal.org/node/2647298
- https://www.drupal.org/project/devel/issues/2277303
- https://www.drupal.org/project/devel/issues/2277303
Simply copy this into your settings.php and change the value accordingly (Kint default: 7)
// 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. Currently there doesn't seem to be a cleaner way to set this:
Kint::$maxLevels = 4;
}
// Change kint maxLevels setting:
if (class_exists('Kint')) {
\Kint::$depth_limit = 5;
}
Just wanted to comment that at least for kint
4.1.1
you need to use\Kint::$depth_limit
instead of\Kint::$max_depth
. I hope that helps somebody to save some time 🙂