pattern-lab / patternengine-php-twig

Twig-based PatternEngine for Pattern Lab.
http://patternlab.io/
MIT License
78 stars 36 forks source link

Tag embed not working anymore #20

Closed schauer closed 8 years ago

schauer commented 8 years ago

The commit https://github.com/pattern-lab/patternengine-php-twig/commit/b5ed124547944abc7a0d5ad70be2523b60c63934 prevents using the Tag embed. The Solution is to add another Node Visitor EmbedNodeVisitor which creates an PatternDataEmbedNode exending _Twig_NodeEmbed. In Addition prevent in the IncludeNodeVisitor creating a PatternDataIncludeNode class in case the $node is an object of _Twig_NodeEmbed. Something like if ($node instanceof \Twig_Node_Include && !($node instanceof \Twig_Node_Embed)) {

aleksip commented 8 years ago

Thanks for reporting, will look into it.

TxHawks commented 8 years ago

@aleksip - Is there any way to temporarily work around this? I rely on embed pretty heavily.

schauer commented 8 years ago

@TxHawks Replacing in the file IncludeNodeVisitor the line 16 if ($node instanceof \Twig_Node_Include) { with if ($node instanceof \Twig_Node_Include && !($node instanceof \Twig_Node_Embed)) { can be a temporarily solution,

aleksip commented 8 years ago

@schauer @TxHawks Working on this right now, hope to have a solution ready today!

schauer commented 8 years ago

Thank you, I did not want to rush you.

aleksip commented 8 years ago

@schauer @TxHawks Just created a pull request containing a fix for this issue. At least it worked for me. Would be great if you could test it too.

schauer commented 8 years ago

@aleksip Looks good to me. I have tested it, and it worked both, include and embed. Thanks!

TxHawks commented 8 years ago

Works here as well

aleksip commented 8 years ago

@schauer @TxHawks Thanks for testing!

@dmolsen Thanks for merging!

dmolsen commented 8 years ago

v0.7.1 is now out on Packagist.