jafacakes2011
jafacakes2011

Reputation: 178

Drupal 8 Twig isn't working for Debug

I have been messing around with Drupal 8 and seen that in the status report it suggested I should add the Twig C Extension, after adding it I begun to get the following error when using Kint in a theme template file.

Warning: file(/Users/jafacakes2011/Sites/site/recipe-hub/vendor/twig/twig/lib/Twig/Environment.php(403) : eval()'d code): failed to open stream: No such file or directory in Drupal\kint\Twig\KintExtension->kint() (line 78 of /Users/jafacakes2011/Sites/site/recipe-hub/modules/contrib/devel/kint/src/Twig/KintExtension.php).

I Installed PHP and Twig using homebrew: brew install php56 php56-twig php56-mcrypt php56-opcache

You can see in the image below that twig is on my php server.

The error lead me to believe that it was a permissions issue, but all permissions seemed ok in the vendor twig folder.

Upvotes: 8

Views: 4349

Answers (3)

Alberto Galvis
Alberto Galvis

Reputation: 101

I applied that patch and it worked: https://www.drupal.org/node/2731381#comment-11308631

My version of drupal is: 8.2.2

Additional settings:

Go to admin/config/development/devel:
Error handlers --> Kint options
Variables Dumper --> Kint

Upvotes: 0

marco
marco

Reputation: 151

this seems to be a kint twig extension issues (see this issue in the devel issues queue https://www.drupal.org/node/2731381)

As workaround you can:

  • go to devel settings page and set kint as the default dumper

  • use {{ devel_dump() }} instead of {{ kint() }} for debug variables in twig template

{{ devel_dump() }} not have all the features offered by the kint twig extension but work well and no suffers from this issue.. the output produced by the devel twig extension is almost equal

Upvotes: 5

jimafisk
jimafisk

Reputation: 29

What fixed this for me was going to '/admin/config/development/devel' and changing the Error handlers from "Standard Drupal" to "Kint backtrace above the rendered page." I also set the Variables Dumper to Kint for a nicer output.

Upvotes: 2

Related Questions