studioespresso / craft-dumper

Bringing larapack/dd to your Craft3 website
MIT License
21 stars 2 forks source link

Added override function for Craft's dump variant #8

Closed bertoost closed 6 years ago

bertoost commented 6 years ago

With the same 'is safe' check

And not breaking current dump methods d() and dd().

janhenckens commented 6 years ago

Hey Bert! Thanks for the PR! When I try {{ dump(variable) }} in twig (in a plugin template), it prints the raw HTML but not the "parsed" dump. Am I missing any parameters?

bertoost commented 6 years ago

What exactly do you dump? Some variables, like Redactor content, are actually objects which will be parsed when calling it directly as “entry.body”. Only then it will be parsed and shown well.

janhenckens commented 6 years ago

I was dumping an array with 1 object in it (a model with some string values). Weird, cause both d() and dd() can parse it without issue. Will look into it.

bertoost commented 6 years ago

Thats weird indeed. I tried dump() myself and works fine my side... Maybe something along your installation or usage. Like to know.

janhenckens commented 6 years ago

Had to echo the results instead of just returning them, that fixed it. Merged & released an update with this update!

bertoost commented 6 years ago

Ah okay! I remember how that comes... I have used \Twig_SimpleFunction() and on the very last moment I changed it to \Twig_Function() to be compatible with yours. Assumed they worked the same I guess :-) Thanks anyway!