4

Normally, I can use kint() in the place of dump() to debug my twig templates. The theming manual agrees.

However, this doesn't work for me in Commerce 2.

In commerce-product.html.twig, I added

{{ kint(product) }}

And rebuilt the cache.

This caused me to be redirected to the "install" url, with the message "Drupal is already installed".

If I use {{ dump(product) }}, I get the expected output, but this array is enormous and hard to read so I want to use kint. Is there something different about variables in Commerce?

If I use {{ kint(links) }} and the like in a template copied from core I see the kint output correctly.

1

2 Answers 2

5

The object/array is too big for your server resources to handle the default kint settings.

Edit modules/devel/kint/kint/config.default.php and set $_kintSettings['maxLevels'] to a lower number to reduce recursion and the memory needed for dumping variables. The default is 7, I have mine set to 4. If 4 still doesn't work for you, keep lowering the number.

4

For debug big array, i use first :

{{kint($array|keys)}}

after i got key i can kint the array with the key. With this method i don’t have memory error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.