I am looking for a hook in twig engine with that I can transform something like
<foo bar="baz" />
into
{{ func("foo", { bar: "baz" } ) }}
I am not sure how I can achieve this and where in the compilation process this must happen. Is this a NodeVisitor or rather responsibility of a TokenParser? Or something completely else? Should this maybe happen at FileLoader / Cache level and with regex replacing? Unfortunately the twig documentation does not cover such a topic in depth.
Looking forward for any advices and tips, thank you.
PS: I know I could just simply put the second snippet in the template but I want to provide the first snippet as some kind of nice-to-have option that will be converted to the second snippet.
I am looking for a hook in twig engine with that I can transform something like
<foo bar="baz" />
into
{{ func("foo", { bar: "baz" } ) }}
I am not sure how I can achieve this and where in the compilation process this must happen. Is this a NodeVisitor or rather responsibility of a TokenParser? Or something completely else? Should this maybe happen at FileLoader / Cache level and with regex replacing? Unfortunately the twig documentation does not cover such a topic in depth.
Looking forward for any advices and tips, thank you.
PS: I know I could just simply put the second snippet in the template but I want to provide the first snippet as some kind of nice-to-have option that will be converted to the second snippet.