Call static methods from Twig template #3794
Unanswered
jdescelliers
asked this question in
Q&A
Replies: 1 comment
-
You can create an extension: https://symfony.com/doc/current/templating/twig_extension.html Or pass an object to global variables and call the method on this object. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to call a static method from a Twig template and It cannot be done easily.
The main logic behind this is that 'pure' PHP classes are easier to test than Twig templates.
Is there any way to beautifully call a static method from Twig or any plans to implement this feature?
Beta Was this translation helpful? Give feedback.
All reactions