You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am looking for a way to shim unknown tags from a loaded Twig file, while preserving internal nodes available to the parser/walker.
Are there code examples of how to use registerUndefinedTokenParserCallback()? It's rather trivial to shim with registerUndefinedFunctionCallback() and registerUndefinedFilterCallback(), but I have not found a way to skip unknown tags.
This code works for functions and filters, i.e. $env->registerUndefinedFunctionCallback(shimTwig(TwigFunction::class))
functionshimTwig(string$type) {
returnfunction ($name) use ($type) {
returnnew$type($name);
};
}
The text was updated successfully, but these errors were encountered:
I am looking for a way to shim unknown tags from a loaded Twig file, while preserving internal nodes available to the parser/walker.
Are there code examples of how to use
registerUndefinedTokenParserCallback()
? It's rather trivial to shim withregisterUndefinedFunctionCallback()
andregisterUndefinedFilterCallback()
, but I have not found a way to skip unknown tags.This code works for functions and filters, i.e.
$env->registerUndefinedFunctionCallback(shimTwig(TwigFunction::class))
The text was updated successfully, but these errors were encountered: