fuel / parser

Fuel PHP Framework - v1.x template parser package adapters
http://fuelphp.com
64 stars 45 forks source link

Missing dump() function for twig parser #83

Closed spaced-out-mvc closed 9 years ago

spaced-out-mvc commented 9 years ago

I spent an hour or more trying to get the twig debug() function to work. I read lots of documentations and all pointed to settings debug=true

This didnt work of course. However after manually tracing through the code i found the problem The dump function is not included in the fuel twig extensions list.

Inside this file /fuel/packages/parser/classes/twig/fuel/extension.php

You need to add this line inside getFunctions() 'dump' => new Twig_Function_Function('Debug::dump')

I think the dump() function is the most important function it is required for developers i think.

Previously fuelphp supported this function i think there must have been a recent upgrade which has lost this function from the listing.

I would be good if someone could revise the current list, or at least add the above line to future distributions as it is impossible to find it documented online otherwise.

unless you read this of course... lol

Thanks Daniel

spaced-out-mvc commented 9 years ago

now twig templates i can use {{ dump(var) }} as normal matching the twig documentation

emlynwest commented 9 years ago

I am not aware of this function being supported in any version of this package (Do you have the right repo, this is v2 fuel, not v1) but should be easy enough to add.

emlynwest commented 9 years ago

My mistake, thought this was another repo. Just ignore the above.

spaced-out-mvc commented 9 years ago

This is on the latest Fuelphp v1.7.2 I think last summer it worked fine on which ever version was available then it maybe a case of a conflict within the code somewhere else maybe if the file has not been changed however by adding the line above fixes the issue

It simply adds the dump() function to the fuelphp extension bridge for twig

spaced-out-mvc commented 9 years ago

i have been using it all day since and it works 100% perfect